sebastian-ardila / google-app-engine-django

Automatically exported from code.google.com/p/google-app-engine-django
Apache License 2.0
0 stars 0 forks source link

appid isn't loaded correctly when running with ./manage.py runserver #175

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
The code path which is run when modules are imported via ./manage.py runserver 
does not handle appid correctly.

The following error is raised:

(...)
  File "/home/niemeyer/src/ensemble-server/google_appengine/google/appengine/tools/dev_appserver.py", line 3543, in SetupStubs
    os.environ['APPLICATION_ID'] = app_id
  File "/usr/lib/python2.6/os.py", line 471, in __setitem__
    putenv(key, item)
TypeError: putenv() argument 2 must be string, not None

The problem in this case is that the file db/base.py imports appid like this:

    from appengine_django import appid

So even though appid is correctly loaded by the time SetupStubs() is called, 
the module is still seeing the None version which was previously imported.

Original issue reported on code.google.com by n13m3y3r on 30 Jun 2010 at 6:28

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Sorry, turns out that the main problem is caused by relative imports and the 
same module being imported twice, rather than the form in which the import 
takes in the base.py file.

In practical terms, there's that structure:

myapp/__init__.py
myapp/manage.py
myapp/appengine_django/...

appengine_django is not usable as myapp.appengine_django due to the way 
importing and configuration loading works.

Given that, I'm not sure about what's the value of myapp/__init__.py at all.

Original comment by n13m3y3r on 30 Jun 2010 at 6:45

GoogleCodeExporter commented 9 years ago

Original comment by m...@google.com on 20 Aug 2011 at 4:51