I am trying to use PyInstaller to package a Django project. Packages I am using:

Mac OS X 10.8.2
Python 2.7.3 64-bit from Python.org (not from Apple)
Django 1.4.0
PyInstaller 2.0

The "project" I am trying to package is actually just the minimal example Django site that is created by typing "django-admin.py startproject mysite". Thus, the "project" has no pages and it just shows the static page "Congratulations, Django works".

Here is my manage.py file:

#!/Library/Frameworks/Python.framework/Versions/2.7/bin/python
import os
import sys
import mysite.settings

# I have to do the following imports to avoid ImportErrors, I
# guess PyInstaller cannot find these modules otherwise:
import django.contrib.messages
import mysite.wsgi
import django.middleware
import django.middleware.common
import django.contrib.sessions.middleware
import django.middleware.csrf
import django.contrib.auth.middleware
import django.contrib.messages.middleware
import django.template.defaulttags
import django.template.defaultfilters

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mysite.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)

I package it with PyInstaller by doing the following:

mac> python /path/to/pyinstaller.py manage.py

PyInstaller completes without any complaints. Then I start the packaged executable (on the same machine that packaged it) and it starts up fine:

mac> cd dist/manage
mac> ./manage runserver
Validating models...

0 errors found
Django version 1.4, using settings 'mysite.settings'
Development server is running at http://127.0.0.1:8000/
Quit the server with CONTROL-C.

But then I open my browser and try to load a page. When I load a page, that is when it throws an exception:

Traceback (most recent call last):
File "/Users/zakf/progs/zapp/djproject/build/pyi.darwin/manage/out00-PYZ.pyz/wsgiref.handlers", line 85, in run File "/Users/zakf/progs/zapp/djproject/build/pyi.darwin/manage/out00-PYZ.pyz/django.contrib.staticfiles.handlers", line 67, in __call__ File "/Users/zakf/progs/zapp/djproject/build/pyi.darwin/manage/out00-PYZ.pyz/django.core.handlers.wsgi", line 241, in __call__ File "/Users/zakf/progs/zapp/djproject/build/pyi.darwin/manage/out00-PYZ.pyz/django.core.handlers.base", line 179, in get_response File "/Users/zakf/progs/zapp/djproject/build/pyi.darwin/manage/out00-PYZ.pyz/django.core.handlers.base", line 221, in handle_uncaught_exception File "/Users/zakf/progs/zapp/djproject/build/pyi.darwin/manage/out00-PYZ.pyz/django.views.debug", line 66, in technical_500_response File "/Users/zakf/progs/zapp/djproject/build/pyi.darwin/manage/out00-PYZ.pyz/django.views.debug", line 274, in get_traceback_html File "/Users/zakf/progs/zapp/djproject/build/pyi.darwin/manage/out00-PYZ.pyz/django.template.base", line 125, in __init__ File "/Users/zakf/progs/zapp/djproject/build/pyi.darwin/manage/out00-PYZ.pyz/django.template.base", line 152, in compile_string File "/Users/zakf/progs/zapp/djproject/build/pyi.darwin/manage/out00-PYZ.pyz/django.template.debug", line 35, in __init__ File "/Users/zakf/progs/zapp/djproject/build/pyi.darwin/manage/out00-PYZ.pyz/django.template.base", line 232, in __init__ File "/Users/zakf/progs/zapp/djproject/build/pyi.darwin/manage/out00-PYZ.pyz/django.template.base", line 339, in add_library
AttributeError: 'NoneType' object has no attribute 'tags'
[10/Dec/2012 00:42:23] "GET / HTTP/1.1" 500 59

Any idea how to fix this?

Thank you,

Zak F.

--
You received this message because you are subscribed to the Google Groups 
"PyInstaller" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/pyinstaller?hl=en.

Reply via email to