How to create an environment for Python Web-Application in Ubuntu Cloud Servers

Preparing an Ubuntu cloud server from scratch to create an environment for Python Web-Application
Riddhi Jindal
Riddhi Jindal

Created: 05/19/2020 12:02 PM - Updated: 05/19/2020 12:29 PM

On Ubuntu 13.10

Steps for creating environment

·         Updating the system

·         Installing necessary tools and libraries 

·         Creating deployment environment

 

System Update


To update the system run following commands:


 

    aptitude update        

    aptitude -y upgrade


Getting The Necessary System Tools And Libraries

Installing  build-essential package 

aptitude install -y build-essential       

Next, whichever version control tool you need for development:

aptitude install -y cvs subversion git-core mercurial     


Some essential Python packages

aptitude install python-setuptools python-dev \ python2.7-dev python-software-properties \libpq-dev   


Libraries for image processing:

aptitude install libtiff4-dev libjpeg8-dev \zlib1g-dev libfreetype6-dev liblcms2-dev \libwebp-dev tcl8.5-dev tk8.5-dev  

 

Getting The Common Python Tools 


Getting pip's dependency:

curl https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py | python -



# and pip:


curl https://bootstrap.pypa.io/get-pip.py | python -



# add the PATH variable:

export PATH="/usr/local/bin:$PATH"

An environment can be best describes as an isolated location (a directory) where everything resides. For this purpose, a tool called virtualenv is used.

Installing virtualenv 

pip install virtualenv  


Creating Environment For Python Web-Application  

Run the following commands to create a virtual environment


Create a virtual environment


virtualenv django_app


Enter the directory to start working with the Python interpreter:

cd django_app


Activate the *virtualenv*:

source bin/activate


Or call the Python interpreter directly whenever you need to work with the application located inside this environment, like:

bin/python manage.py runserver 0.0.0.0:8000


Was this article helpful?

0 Out of 0 Marked As Helpfull

Have more questions? Please Contact Us