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


  • Please log in to reply

#16
FutbolMolly

FutbolMolly

    Member

  • Topic Starter
  • Member
  • PipPip
  • 33 posts
Yes, it is a server with only the site on it.

It is going to be accessed by just clicking on the file and hopefully that will launch the site.

I start the server by going here: C:\dev\incidents and then i click run server, and then i would be able to run the site, that's why i somehow need to put them together.

thanks :)
  • 0

Advertisements


#17
Artellos

Artellos

    Tech Secretary

  • Global Moderator
  • 3,915 posts

I start the server by going here: C:\dev\incidents and then i click run server, and then i would be able to run the site, that's why i somehow need to put them together.


Isn't it a possibility to leave the server running 24/7? (Like most dedicated servers :) )

Regards,
Olrik
  • 0

#18
FutbolMolly

FutbolMolly

    Member

  • Topic Starter
  • Member
  • PipPip
  • 33 posts
I'm not sure! The server is running from my computer, if I left it up and running then others on other computers would still be able to see it?? The thing is that i'm just an intern so my account will eventually get shut down, so I'm not sure how it would work to keep it running 24/7. I don't know too much about servers! I would rather just make it a regular website, but they are being weird about spending money and getting caught by the company because they probably aren't allowed to make a website. If there is a way to make the server run 24/7 i will do that! thanks :)

Molly
  • 0

#19
Artellos

Artellos

    Tech Secretary

  • Global Moderator
  • 3,915 posts
You don't have to be allowed to have an intern website running.
You don't have to spend a lot of money to have a small server running.
Just have separate workstation (a normal PC) somewhere with the server running.
Look up the IP address of the server and put that in the program.

Then leave it running 24/7 and let the people use the exe to open a web-page to the server.
You can if you want to add an Icon to the program as well.
You'd need to change the setup.py to the following code box and have the .ico file in the directory where the setup.py is.

from distutils.core import setup
import py2exe


setup(
	windows = [
		{
			"script": "example.py",
			"icon_resources": [(1, "example.ico")]
		}
	],
)

Regards,
Olrik

Edited by Artellos, 09 June 2008 - 01:25 PM.

  • 0

#20
FutbolMolly

FutbolMolly

    Member

  • Topic Starter
  • Member
  • PipPip
  • 33 posts
Thank you very much for all of your help, I really appreciate it :)
  • 0

#21
Artellos

Artellos

    Tech Secretary

  • Global Moderator
  • 3,915 posts
You're welcome! :)
If you have any questions, I will keep e-mail notification on this thread so feel free to post back.

Regards,
Olrik
  • 0

#22
FutbolMolly

FutbolMolly

    Member

  • Topic Starter
  • Member
  • PipPip
  • 33 posts
Hey Artellos,

One more question for you :)

I figured out that I couldn't keep a computer running at all times because each user's computer has a different server. I figured out the code to make this work:

import os, sys
sys.path += [r'c:\dev\incidents']
os.environ['DJANGO_SETTINGS_MODULE'] = 'incidents.settings'
from django.core.management import call_command
from threading import Thread
t = Thread(target=call_command, args=('runserver',), kwargs={'shutdown_message':"done", 'use_reloader':False})
t.start()

import webbrowser
webbrowser.open('http://127.0.0.1:8000/admin/base/incident/add/')

I also had to change my setup a little:

from distutils.core import setup
import py2exe
import sys
sys.argv.append("py2exe")

setup(windows = [{"script": 'pyweb.py'}])

Everything was working great until I went to make it into an .exe -- I made it into it and when I run it, I get an error saying to see the logfile in my file, so i did that and these are the errors it is giving me:

Exception in thread Thread-1:
Traceback (most recent call last):
  File "threading.pyc", line 486, in __bootstrap_inner
  File "threading.pyc", line 446, in run
  File "django\core\management\__init__.pyc", line 125, in call_command
CommandError: Unknown command: 'runserver'

Exception in thread Thread-1:
Traceback (most recent call last):
  File "threading.pyc", line 486, in __bootstrap_inner
  File "threading.pyc", line 446, in run
  File "django\core\management\__init__.pyc", line 125, in call_command
CommandError: Unknown command: 'runserver'

Exception in thread Thread-1:
Traceback (most recent call last):
  File "threading.pyc", line 486, in __bootstrap_inner
  File "threading.pyc", line 446, in run
  File "django\core\management\__init__.pyc", line 125, in call_command
CommandError: Unknown command: 'runserver'

I'm not sure what to do to change that line runserver??

Thanks :)

Edited by FutbolMolly, 10 June 2008 - 12:33 PM.

  • 0

#23
Artellos

Artellos

    Tech Secretary

  • Global Moderator
  • 3,915 posts
import os, sys
sys.path += [r'c:\dev\incidents']
os.environ['DJANGO_SETTINGS_MODULE'] = 'incidents.settings'
from django.core.management import call_command
from threading import Thread
t = Thread(target=call_command, args=('runserver',), kwargs={'shutdown_message':"done", 'use_reloader':False})
t.start()

import webbrowser
webbrowser.open('http://127.0.0.1:8000/admin/base/incident/add/')

If this works when you doubleclick the .py then leave it.
Make SURE that on EVERY PC you use it on the server thing is installed at "C:\dev\incidents"

Now for the setup:

from distutils.core import setup
import py2exe
import sys
sys.argv.append("py2exe")

setup(windows = [{"script": 'pyweb.py'}])

Why did you add the lines:
import sys
sys.argv.append("py2exe")
?

you don't need them because the compile.bat does that for you.

Regards,
Olrik
  • 0

#24
FutbolMolly

FutbolMolly

    Member

  • Topic Starter
  • Member
  • PipPip
  • 33 posts

Why did you add the lines:
import sys
sys.argv.append("py2exe")
?


I added these two lines because without them when I would make my exe, it would create me the file dist and built but dist would have nothing in it. I read about it online and people said that I needed to add in those 2 lines, and then it did work. I don't understand why it wouldn't work without them though.

Also, do you know why I would be getting the errror when i run the server:
CommandError: Unknown command: 'runserver'

Is there something wrong with the 'runserver' part of my code??

Thank you, Olrik
  • 0

#25
Artellos

Artellos

    Tech Secretary

  • Global Moderator
  • 3,915 posts
Replace the following lines
import sys
sys.argv.append("py2exe")

with

##import sys
##sys.argv.append("py2exe")

Then run compile.bat
Does it still give you the errors?

Regards,
Olrik
  • 0

Advertisements


#26
FutbolMolly

FutbolMolly

    Member

  • Topic Starter
  • Member
  • PipPip
  • 33 posts
I now get one more error:

Exception in thread Thread-1:
Traceback (most recent call last):
  File "threading.pyc", line 486, in __bootstrap_inner
  File "threading.pyc", line 446, in run
  File "django\core\management\__init__.pyc", line 125, in call_command
CommandError: Unknown command: 'runserver'

Traceback (most recent call last):
  File "pyweb.py", line 11, in <module>
EOFError: EOF when reading a line

  • 0

#27
FutbolMolly

FutbolMolly

    Member

  • Topic Starter
  • Member
  • PipPip
  • 33 posts
I guess it is something wrong with my code..

Thanks for all the help, Olrik
  • 0

#28
Artellos

Artellos

    Tech Secretary

  • Global Moderator
  • 3,915 posts
Does the pyweb.py work when you don't compile it to an exe?

Regards,
Olrik
  • 0

#29
FutbolMolly

FutbolMolly

    Member

  • Topic Starter
  • Member
  • PipPip
  • 33 posts
Yes it does.
  • 0

#30
FutbolMolly

FutbolMolly

    Member

  • Topic Starter
  • Member
  • PipPip
  • 33 posts
I figured it out :)

I just started the server a different way and it worked.

Thanks for everything :)
  • 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