I have a Django 1.1.1 project that works fine. I'm trying to import it to Google App Engine.
I'm trying to follow these instructions.
I run it on the dev server, and I get an import error:
ImportError at /
No module named mysite.urls
This is the folder structure of mysite/:
app.yaml
<DIR> myapp
index.yaml
main.py
manage.py
<DIR> media
settings.py
urls.py
__init__.py
app.yaml:
application: mysite
version: 1
runtime: python
api_version: 1
handlers:
- url: .*
script: main.py
from settings.py:
ROOT_URLCONF = 'mysite.urls'
What am I doing wrong?
UPDATE:
now I get this error:
Request Method: GET
Request URL: http://localhost:8082/
Exception Type: AttributeError
Exception Value: 'module' object has no attribute 'autodiscover'
Exception Location: C:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver.py in LoadModuleRestricted, line 1782
main.py:
import logging, os
# Google App Engine imports.
from google.appengine.ext.webapp import util
# Force Django to reload its settings.
from django.conf import settings
settings._target = None
# Must set this env var before importing any part of Django
# 'project' is the name of the project created with django-admin.py
os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite.settings'
import logging
import django.core.handlers.wsgi
import django.core.signals
import django.db
import django.dispatch.dispatcher
def log_exception(*args, **kwds):
logging.exception('Exception in request:')
# Log errors.
django.dispatch.dispatcher.connect(
log_exception, django.core.signals.got_request_exception)
# Unregister the rollback event handler.
django.dispatch.dispatcher.disconnect(
django.db._rollback_on_exception,
django.core.signals.got_request_exception)
def main():
# Create a Django application for WSGI.
application = django.core.handlers.wsgi.WSGIHandler()
# Run the WSGI CGI handler with that application.
util.run_wsgi_app(application)
if __name__ == '__main__':
main()
Directory structure of engineapp/:
<DIR> mysite
app.yaml
index.yaml
main.py
Directory structure of engineapp/mysite:
<DIR> myapp
<DIR> media
__init__.py
initial_data.json
manage.py
settings.py
urls.py
I feel like I'm getting closer, but still not there.