Forums

could not import settings

I have configured a project and setup mysql, when i run basantrijal.pythonanywhere.com i get "Unhandled Exception" error. I have already gone through the issue related to this but its not working for me.

When i see error log error is..
ImportError: Could not import settings mysite.settings' (Is it on sys.path? Is there an import error in the settings file?): No module named 'mysite.settings'

I think i am missing something. Can u help me? Thanks in advance

It looks like you've deleted that web app since posting your message, but one common cause of errors like that is that you put (say) /home/basantrijal/mysite on the path and then try to import mysite.settings, when the settings.py file is actually in /home/basantrijal/mysite. The fix is to put /home/basantrijal/ on the path instead.

Might that have been it?

okay i have set path a/c to my folder structure. but now i am getting another error.

ImportError: importlib._bootstrap is not a frozen module

can u look into that?

It looks like there's a bug in Django on Python 3,3 where it gives that error when there's a different underlying problem. If you look a little further up in your log file you'll see a different error:

ImportError: No module named 'rest_framework'

I think that's the problem. What rest_framework module are you expecting to have present?

i have defined djangorestframework in requirements.txt file. when i run pip install --user -r requirements.txt it says already present. Same copy is working fine in local what might be the issue?

pip on its own is for Python 2.7, and it looks like you're using 3.3.

Try pip3.3 install --user -r requirements.txt -- that should get everything installed.

sorry still running on same issue.. may be problem is with routing AttributeError: 'RegexURLResolver' object has no attribute '_urlconf_module' ?

did u find anything @giles PA staff ? app created from pythonanywhere works fine but when i upload my files it gives problem..

Have you reloaded the web app (from the "Web" tab) since you installed the dependencies?

No worries i fixed it. I create app with python version 2.7 and imported my files and its working just fine. Previous app was created in python 3.3 which was not working i dont know may be compability issue with django1.6. In my local i have python 2.7 and django1.6 perfectly working fine.

Thanks for your help @giles.

No problem, glad you got it working!