Home » Categories » Multiple Categories |
How To Setup uWSGI On Ubuntu 12.10 |
Article Number: 263 | Rating: Unrated | Last Updated: Sat, Jan 4, 2014 at 1:35 AM
|
uWSGI provides an implementation of the WSGI specification and is both a protocol and an application server. For more, please refer to the uWSGI docs here. Although in this tutorial we will setup a standalone uWSGI server, it is generally kept behind nginx.
Prerequisitesssh -p 25000 demo@12.34.56.789 Remember to replace '2500' with the number of port you used in the previous article. Replace 'demo' with your username and '12.34.56.789' with your IP. The server needs to be equipped with Python; since you have installed Ubuntu 12.04, you might already have Python 2.7.3 installed. Step 1: Install Pip and Python EssentialsWe will download the Python development headers as we will be deploying a small application written in Python. sudo apt-get install build-essential python-dev sudo apt-get install python-pip Step 2: Install dependent packagesNext, install the required packages. sudo apt-get install libxml2-dev sudo apt-get install libxslt1-dev Step 3: Install PipWe will install uwsgi from pip and not using aptitude, as Aptitude seems to install an older version of uwsgi. sudo pip install uwsgi Step 4: Create a small ApplicationWe will create a small application and render a text. Create the following folder and then a python file inside it. mkdir ~/projects vim ~/projects/app.py Copy the following contents in this file: def application(env, start_response): start_response('200 OK', [('Content-Type','text/html')]) return "Hello World" Step 5: Launch the Application via uWSGIAssuming that you have created a 'demo' user using 'adduser' as mentioned in the Pre-requisites sections, you can run the following to start serving the application at a port of your choice: sudo uwsgi --http :port_num; --wsgi-file app.py --uid <username> sudo uwsgi --http :9090 --wsgi-file app.py --uid demo Step 6: Confirmation: Access the ApplicationYou can confirm that uWSGI has been installed and running by directing your browser to your http://<IP address:port>: ifconfig eth0 | grep inet | awk '{ print 2 }' When you visit your <IP address:port> page in your browser, you will see the words: "Hello World" uWSGI installed and a sample application served by it. |
Attachments
![]()
There are no attachments for this article.
|
How to Setup a Multi-Protocol VPN Server Using SoftEther
Viewed 9816 times since Thu, Jan 2, 2014
A Comparison of Web Servers for Python Based Web Applications
Viewed 2934 times since Sat, Jan 4, 2014
How To Install and Use Memcache on Ubuntu 12.04
Viewed 3765 times since Tue, Dec 24, 2013
How To Set Up Python 2.7.6 and 3.3.3 on CentOS 6.4
Viewed 7645 times since Sat, Jan 4, 2014
How To Launch Your Site on a New Ubuntu 12.04 Server with LAMP, SFTP, and DNS
Viewed 2862 times since Thu, Dec 26, 2013
How to Install OpenVPN Access Server on Ubuntu 12.04
Viewed 3677 times since Thu, Jan 2, 2014
How To Install Linux, Apache, MySQL, PHP (LAMP) stack on Ubuntu
Viewed 6882 times since Thu, Jan 2, 2014
Docker Explained: How To Create Docker Containers Running Memcached
Viewed 8762 times since Sat, Jan 4, 2014
How To Install Wordpress on Ubuntu 12.04
Viewed 2801 times since Tue, Dec 24, 2013
Initial Server Setup with Ubuntu 12.04
Viewed 2626 times since Mon, Dec 23, 2013
|