Forums

Struggling to follow this tutorial - https://blog.pythonanywhere.com/87/

Hello,

I have made it up to the point where I have to amend the wsgi.py files. I think I have done this correctly but for some reason it still will not run. I get: Error code: Unhandled Exception

My website was working ok on Heroku, and now when I have pushed it to my new PA git repo (as per tut), it will not run.

My wsgi.py file is as follows

import os
import sys

path = '/var/www/sites/aqa/'
if path not in sys.path:
sys.path.append(path)

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mvp_landing.settings")

import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()

If someone could help suggest a possible fix (i.e things to look out for when pushing django apps), or if someone from PA can look at my files that would be great.

Many thanks,

Jack Chambers

I can see that you have a requirements file that includes Django 1.6 and that you're using Python 2.7. That means that you'll need to use a virtualenv, but I don't see that activation code in your wsgi file. Here's a tutorial about using Django in a virtualenv

Also, your error log will usually have exception tracebacks that will help you diagnose issues like this.

Hi Glenn,

I have spent most the evening now on this and whilst it has definitely progressed (virtualenv created, and at least something is showing), it seems that still something is wrong and the error log is still a mess.

I have the activation code in my wsgi file, is it just that I am not referencing my settings ok.

I take it that my settings will be ok to keep as they are?

It has now gotten to the point where it doesn't create an error log, yet issues such as not being able to syncdb still exist.

Many thanks again.

Whether or not you can keep your settings as they are will depend entirely on the settings and how they are set.

"something is wrong" and "not being able to syncdb" are not very useful. What is wrong, exactly? What happens when you try to syncdb?

Thank you for your help. I will resolve this another way.