Now to deploy in a first step an application on the fix IP with our a domain name

December 8, 2014 2.6k views

i do not manage to deploy my web application.

I am using
Python 3.4
Droplet Ubuntu 14.4

I have a running django application local on my window pc by running this cmd line Python runserver

Now I try to deploy it on my vps and I do not know
We’re do I have to copy my django application? In which folder?
Apache site config need virtual host configuration, but I have not domain name for the moment I will by one later but I would to see my web application on Internet by entering the fix ip of my droplet.

Could you please help me?

2 Answers

Hey! There are a lot of ways to deploy a Django project. Are you running into a specific issue?

To deploy a Python app in a virtualenv using Mod_wsgi and Apache, first install the dependencies:

sudo apt-get install python-pip python-virtualenv libapache2-mod-wsgi apache2

Now put your Django project files onto the server and create your virtualenv. Generally a directory in /var/www/ will do. They key is to make sure to use the correct path is in your Apache configuration. If your virtualenv is located in /var/www/myapp/ then your Apache config (/etc/apache2/sites-enabled/000-default.conf) would be:

<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/myapp

    WSGIDaemonProcess myapp python-path=/var/www/myapp:/var/www/myapp/env/lib/python2.7/site-packages
    WSGIProcessGroup myapp
    WSGIScriptAlias / /var/www/myapp/myapp/

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

For more details, check out the article How to Run Django with mod_wsgi and Apache with a virtualenv Python environment on a Debian VPS

by Mateusz Papiernik
This article will take you through some key aspects of running mod_wsgi and Apache with a virtualenv Python environment on a Debian VPS.
  • Thank’s a lot. Finally I get it running. How to deal with the fix IP address and domain name wasn’t clear for me now it is.

Have another answer? Share your knowledge.