0

enter image description here

I am working to set up a django project on ec2 with an Ubuntu 14.4 LTS instance. I want to write my code using python 3 and django. I'm following http://www.nickpolet.com/blog/deploying-django-on-aws/1/ and have been able to get the django start page working. Previously I added django to both the default python 2.7 and the installed python 3.4.

I've created a virualenv and if I run the program after activating the virualenv I can use the python 3.4 interpreter. However, while testing I got the following error when I open the amazon ip address:

Exception Location:     /usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py in get_response, line 111
Python Executable:  /usr/bin/python
Python Version:     2.7.6

As you can see the default python interpreter is in use. How do you force django to use the python 3 virtualenv?

user1592380
  • 34,265
  • 92
  • 284
  • 515
  • http://stackoverflow.com/questions/26560636/django-1-7-installation-using-pyvenv-with-python-3-4-in-ubuntu-trusty-14-04 says that virtualenv is broke in ubuntu 14.04. You need to make sure to update it prior to creating your virtualenv. Also, when you installed django where you in a active state in your virtual env? – Jared Mackey Mar 02 '15 at 19:37
  • I used virtualenvwrapper, and I think it worked fine . My virtualenv was in the active state and I could see packages being installed in the python 3.4 directory – user1592380 Mar 02 '15 at 19:49
  • I appreciate you looking at this. However I Iooked your link above and there doesn't seem to be a connection to using a python 3 interpreter. just to reiterate i can get django working fine on python 2.7, but I want to use python 3 . – user1592380 Mar 02 '15 at 20:36
  • Understood and thank you, I will take another look at it – user1592380 Mar 02 '15 at 20:56
  • I have a follow up at http://stackoverflow.com/questions/28830917/python-uwsgi-setup-on-ec2 – user1592380 Mar 03 '15 at 11:42

1 Answers1

1

I had a similar issue using apache and mod_wsgi and was unable to figure it out so I used this guide here and went with nginx and uwsgi and it worked awesome in like 30 minutes. Here is a quick tutorial on how to use uwsgi

Jared Mackey
  • 3,998
  • 4
  • 31
  • 50