How do I make my droplet run Django from my virtualenv?

Posted January 31, 2015 11.4k views

I did the 1-click Ubuntu/Django install. I’m trying however to run my Django project I migrated over which is contained within a virtualenv. Is there a config file with wsgi or nginx I need to edit to “point” it at virtualenv? I currently have my project migrated over but when I visit the IP for the droplet, all I see is the generic “congratulations on your first django page” message. What am I doing wrong?

  • Where does the 1-click install put the uwsgi.ini file?

  • Did you ever figure this out. I’m having the same issues.

  • first pip install guinicorn into your virtualenv

    Then you need to edit /etc/init/guincorn.conf to point to your project and the gunicorn in your virtualenv.

    It is also important to note that if you have any environment variables in your django project they need to be included in the .conf as well


    description "Start Gunicorn Daemon for Forte Project"
    author "Jeffrey Balinsky"
    start on (filesystem)
    stop on runlevel [016]
    env TEMPLATE_DIR=/home/django/forte/templates
    env STATIC_DIR=/home/django/forte/static
    env DBUSR=django
    env DBPW=*******
    chdir /home/django/forte
    exec /home/django/prod/bin/gunicorn \
        --bind= \
  • Thanks for that.

    I’m guessing /home/django/forte is your project folder and /home/django/prod your virtualenv?

    I just get the following when restarting gunicorn

    stop: Unknown instance:
    start: Job failed to start

  • you guessed right

    i forgot to mention when you change the .conf file you have to run:

    initctl reload-configuration


    restart gunicorn

  • Show 4 more comments

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
2 answers

Sorry to see that your question hasn’t received an answer yet. Unfortunately, after this much time, it is unlikely that an answer for this specific question will be provided. For people still landing here via search, check out this updated tutorial set up Django using a virtualenv:

by Jeremy Morris
In this tutorial, we will set up a Django development environment. We’ll install Python 3, pip 3, Django and virtualenv in order to provide you with the tools necessary for developing web applications with Django.