diff --git a/en/_posts/2015-02-14-how-to-run-bottle-uwsgi-nginx.markdown b/en/_posts/2015-02-14-how-to-run-bottle-uwsgi-nginx.markdown index 9498b80..a09b66d 100644 --- a/en/_posts/2015-02-14-how-to-run-bottle-uwsgi-nginx.markdown +++ b/en/_posts/2015-02-14-how-to-run-bottle-uwsgi-nginx.markdown @@ -12,7 +12,7 @@ author: thoorium This setup will make use of _uWSGI_ as the application server because the built-in Bottle web server is __very slow__ and should only be used for __development__. _uWSGI_ is capable of spawning new process of you application and will scale your application when needed. 1. Installing Python, Bottle, uWSGI and Nginx -=============================== +------- In this guide we will be using _Debian Wheezy_ as our host OS. Getting everything installed is easy thanks to the wonderful package manager. @@ -25,7 +25,7 @@ sudo apt-get install python2.7 python-pip uwsgi uwsgi-plugin-python nginx This will install Python, pip (Python package manager), uWSGI, the uWSGI Python plugin and Nginx. _uWSGI_ does not know how to handle Python applications by default and requires the Python plugin in order to function for our needs. 2. Hello Runabove -=============== +------- For this example we will create a basic _Hello Runabove_ bottle application that goes like this: @@ -57,7 +57,7 @@ This application will return a simple "Hello Runabove!" when visited from the we You can clone the full _Hello Runabove_ at the following address: [https://github.com/Thoorium/hello-runabove](https://github.com/Thoorium/hello-runabove) 3. Setting up Bottle and the virtual environment -=============== +------- A good practice with Python is to contain all project's dependencies in a "virtualenv". A virtualenv is lightweight space where a project can have its own dependencies without interfering with system wide python packages. As a second benefit, you won't need to be root anymore to install from __pip__. @@ -80,7 +80,7 @@ sudo venv-bottle/bin/pip install bottle This will create a directory will all the dependencies your python application need to run. By doing so you will prevent any sort of conflicts between python applications if different versions of the same package are used! 4. Configure uWSGI -=========== +------- In order to get _uWSGI_ to run your bottle application, you will first need to create a configuration file for your application. The configuration file is stored in ``apps-available`` and must be copied over to ``apps-enabled`` to work. Both directories are located under ``/etc/uwsgi/``. @@ -121,7 +121,7 @@ sudo service uwsgi start You can read more about _uWSGI_ configuration at [https://uwsgi-docs.readthedocs.org/en/latest/Configuration.html](https://uwsgi-docs.readthedocs.org/en/latest/Configuration.html) 5. Configure Nginx -=========== +------- Now that _uWSGI_ is running and created a socket for us to use, let's configure _Nginx_ to listen to this socket. @@ -167,12 +167,12 @@ sudo service nginx start ``` 6. Test it -=========== +------- Congratulations! Your bottle application is now running live. Navigate to the address you have configured during step 4 and see it by yourself. Troubleshooting -=========== +------- If you are having trouble installing the packages via ``apt-get``, you might need to update your package list. Do so using the following command: