Jump to content

Welcome to Geeks to Go - Register now for FREE

Need help with your computer or device? Want to learn new tech skills? You're in the right place!
Geeks to Go is a friendly community of tech experts who can solve any problem you have. Just create a free account and post your question. Our volunteers will reply quickly and guide you through the steps. Don't let tech troubles stop you. Join Geeks to Go now and get the support you need!

How it Works Create Account
Photo

exe does not work on other computers


  • Please log in to reply

#1
FutbolMolly

FutbolMolly

    Member

  • Member
  • PipPip
  • 33 posts
I am coding in python and i did py2exe.

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
  • 0

Advertisements


#2
FutbolMolly

FutbolMolly

    Member

  • Topic Starter
  • Member
  • PipPip
  • 33 posts
I figured out how to create manage.py into an exe (just had the two files in different folders, whoops!) but it still isn't working.. sigh.. now i'm stumped..
  • 0






Similar Topics

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

As Featured On:

Microsoft Yahoo BBC MSN PC Magazine Washington Post HP