Title: Can I host a python Restful API from wordpress?
Last modified: December 22, 2018

---

# Can I host a python Restful API from wordpress?

 *  [navins](https://wordpress.org/support/users/navins/)
 * (@navins)
 * [7 years, 6 months ago](https://wordpress.org/support/topic/can-i-host-a-python-rstful-api-from-wordpress/)
 * Hello,
 * I am hosting my website through Bluehost and WordPress is my content management
   tool. I’m in need of hosting some restful APIs written in python online. I feel
   it would be good to host it the same server. Can I do it in WordPress, something
   like dropping the python file into a specific location like “html_public/pythonrestapi/
   helloworld.py” and then if I use a URL and get method, I will get the results
   back based on what is written in the python script. If this can be done, please
   let me know how can I do it since I am new to WordPress, if not, please explain
   why because this might help me understand the concepts better.
    -  This topic was modified 7 years, 6 months ago by [navins](https://wordpress.org/support/users/navins/).

Viewing 11 replies - 1 through 11 (of 11 total)

 *  [Joy](https://wordpress.org/support/users/joyously/)
 * (@joyously)
 * [7 years, 6 months ago](https://wordpress.org/support/topic/can-i-host-a-python-rstful-api-from-wordpress/#post-11020067)
 * WordPress can share the document tree with other software, because it uses the.
   htaccess file in its folder to determine which requests to handle. If the file
   requested exists, it is served, otherwise WordPress handles it according to the
   rewrite rules it has built (through creating pages, posts, taxonomies, etc. and
   its API).
 *  Thread Starter [navins](https://wordpress.org/support/users/navins/)
 * (@navins)
 * [7 years, 6 months ago](https://wordpress.org/support/topic/can-i-host-a-python-rstful-api-from-wordpress/#post-11020071)
 * Thanks Joy. So, Is it YES? Can you point me to any resources that is available
   to explain how can I ‘Host a python RestFul API’ from wordpress?
 *  [Joy](https://wordpress.org/support/users/joyously/)
 * (@joyously)
 * [7 years, 6 months ago](https://wordpress.org/support/topic/can-i-host-a-python-rstful-api-from-wordpress/#post-11020088)
 * Have you met Google?
    Try not to think of it as “from WordPress”. Your API is
   on your server, so is WordPress. They are not mixed. If your API reads the WordPress
   database, that still doesn’t make it part of WordPress or anything that WordPress
   knows about.
 *  Thread Starter [navins](https://wordpress.org/support/users/navins/)
 * (@navins)
 * [7 years, 6 months ago](https://wordpress.org/support/topic/can-i-host-a-python-rstful-api-from-wordpress/#post-11020119)
 * Sorry Joy for bothering you again. Maybe I will tell my problem on a high level.
 * My server is a Bluehost shared machine and I have an SSL. Now I have WordPress
   running on it and the website that is created using the WordPress runs in https.
   All is well so far!!! Now I have a requirement where I need to host a python 
   restful API and it should be hosted in https. I have a lot of unknown here,
 * 1. How can I run python restful API on my Bluehost server that already runs my
   WordPress? I was not able to figure it out and that’s where I was checking can
   WordPress in turn host a python restful. Maybe this is a stupid question.
 * 2. How can I reuse the certificate that I bought for my domain name for both 
   WordPress website and python restful API? Maybe this is also a stupid question.
 * I tried to google but not able to find an understandable solution. I thought 
   this forum can help me with what Google couldn’t personally.
 *  [Joy](https://wordpress.org/support/users/joyously/)
 * (@joyously)
 * [7 years, 6 months ago](https://wordpress.org/support/topic/can-i-host-a-python-rstful-api-from-wordpress/#post-11020183)
 * For server configuration questions, you need to be asking your host.
    WordPress
   is just a piece of software that runs on your server. It does not preclude running
   other software there, but has nothing to do with certificates or other APIs.
 *  Moderator [Jan Dembowski](https://wordpress.org/support/users/jdembowski/)
 * (@jdembowski)
 * Forum Moderator and Brute Squad
 * [7 years, 6 months ago](https://wordpress.org/support/topic/can-i-host-a-python-rstful-api-from-wordpress/#post-11021282)
 * > Can I host a python Restful API from wordpress?
 * No, not really.
 * _*Drinks coffee*_
 * The WordPress REST API is expandable meaning you can write your own REST API 
   endpoints in PHP using WordPress in a plugin. That does not mean you can populate
   the WordPress directories with Python scripts. You could but that haas nothing
   to do with WordPress.
 *  [Dion](https://wordpress.org/support/users/diondesigns/)
 * (@diondesigns)
 * [7 years, 6 months ago](https://wordpress.org/support/topic/can-i-host-a-python-rstful-api-from-wordpress/#post-11021875)
 * What you want is impossible on EIG shared hosting plans. VPS plans from EIG would
   require a weberser customized to serve python scripts.
 * I suggest you ask your question on a more appropriate site…perhaps serverfault
   or webhostingtalk.
 *  Thread Starter [navins](https://wordpress.org/support/users/navins/)
 * (@navins)
 * [7 years, 6 months ago](https://wordpress.org/support/topic/can-i-host-a-python-rstful-api-from-wordpress/#post-11021895)
 * Thanks [@jan](https://wordpress.org/support/users/jan/) and [@dian](https://wordpress.org/support/users/dian/).
   I guess like you mentioned I will revert the question to a different site. Thanks,
   [@dian](https://wordpress.org/support/users/dian/) for suggesting forums! its
   helpful
 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [7 years, 6 months ago](https://wordpress.org/support/topic/can-i-host-a-python-rstful-api-from-wordpress/#post-11021898)
 * Heh, one says yes, the other no. Yet they’re both right! Which answer applies
   depends on what software architecture you had in mind. Python from within WP 
   itself would be a NO as Jan said. Python elsewhere on the server such as in /
   cgi-bin/ that is independent from WP would be a YES.
 * If both resources are accessed through the domain of your SSL certificate, then
   it will work for both. If you access your Python API through its filename, that
   file will be served and WP does not enter into the equation. If your Python API
   utilizes a virtual route that is not physically present, you will need a rewrite
   rule set in .htaccess telling the server how to handle such a request.
 * Normally, all virtual routes will go to WP. You need a rule set that sees a specific
   Python API route and redirects such routes to the Python file instead of the 
   WP installation.
 *  Thread Starter [navins](https://wordpress.org/support/users/navins/)
 * (@navins)
 * [7 years, 6 months ago](https://wordpress.org/support/topic/can-i-host-a-python-rstful-api-from-wordpress/#post-11021916)
 * [@bcworks](https://wordpress.org/support/users/bcworks/) Thanks for letting me
   know that there is a possibility 🙂 Though I am not the expert with this I know
   at least where /cgi-bin/ is.
 * With the confidence that you have provided, I will try to develop a sample py
   file and drop it under /cgi-bin/ and access through its file name. The problem
   is I don’t find any relevant information on this on the web, so I will try this
   and keep this thread posted.
 * Thanks again!!
 *  [Dion](https://wordpress.org/support/users/diondesigns/)
 * (@diondesigns)
 * [7 years, 6 months ago](https://wordpress.org/support/topic/can-i-host-a-python-rstful-api-from-wordpress/#post-11022616)
 * > With the confidence that you have provided, I will try to develop a sample 
   > py file and drop it under /cgi-bin/ and access through its file name.
 * And it won’t work on a properly-configured webserver (meaning one that runs CGI
   scripts without requiring 0777 permissions).
 * If you want to reliably serve Python scripts with Apache 2.4.x, please take a
   look at the following:
 * [https://modwsgi.readthedocs.io/en/develop/](https://modwsgi.readthedocs.io/en/develop/)
 * You will not be able to install mod_wsgi on shared hosting, though it is remotely
   possible a shared host will have mod_wsgi installed. If you have a VPS, you can
   follow the installation instructions in the above link to install mod_wsgi.

Viewing 11 replies - 1 through 11 (of 11 total)

The topic ‘Can I host a python Restful API from wordpress?’ is closed to new replies.

 * In: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
 * 11 replies
 * 5 participants
 * Last reply from: [Dion](https://wordpress.org/support/users/diondesigns/)
 * Last activity: [7 years, 6 months ago](https://wordpress.org/support/topic/can-i-host-a-python-rstful-api-from-wordpress/#post-11022616)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
