My exe launches the server and displays the webpage i created at 127.0.0.1:8000
this is my pyweb.py code:
import os import sys from django.core.management import call_command from threading import Thread import thread sys.path += [r'c:\dev'] os.environ['DJANGO_SETTINGS_MODULE'] = 'incidents.settings' t = thread.start_new_thread(os.system, (u'C:\\Python25\\python C:\\dev\\\\incidents\\manage.py runserver > nul', )) import webbrowser webbrowser.open('http://127.0.0.1:8000/admin/base/incident/add/')
this is my setup.py code:
from distutils.core import setup import py2exe import sys if len(sys.argv) == 1: sys.argv.append("py2exe") setup( options = {"py2exe": {"compressed": 1, "optimize": 2, "ascii": 1, "bundle_files": 1}}, zipfile = None, windows = [{"script": 'pyweb.py'}])
Now, I am trying to put the exe I created onto a drive for others who have access to it to you use.
It works perfectly on my computer, but not on theirs.
I know the problem but do not know how i can fix it.
My problem is that in my pyweb.py code I refer to my personal C: drive:
sys.path += [r'c:\dev']
and
t = thread.start_new_thread(os.system, (u'C:\\Python25\\python C:\\dev\\\\incidents\\manage.py runserver > nul', ))
I thought that if I changed manage.py into an exe and put it in the folder where my other drive is that it may work, but when i do py2exe to manage.py it creates dist and build but does not put anything in the files. This is my manage.py code:
#!/usr/bin/env python from django.core.management import execute_manager try: import settings # Assumed to be in the same directory. except ImportError: import sys sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to run django-admin.py, passing it your settings module.\n(If the file settings.py does indeed exist, it's causing an ImportError somehow.)\n" % __file__) sys.exit(1) if __name__ == "__main__": execute_manager(settings)
Or maybe i just need to run a different server...
I don't know, i hope i wasn't too confusing..
Thanks
Molly