i really need a code sample to automate starting Django development webserver "python manage.py runserver" in a .bat file in windows . I have python26 and django 1.1.1 in installed
Thanks
i meant by automate is clicking on the .bat file and the Django development webserver start up and i have no batch file scripting knowledge will love to get a code sample
python manage.py runserver The runserver command is a built-in subcommand of Django's manage.py file that will start up a development server for this specific Django project.
Just create a batch file and save in the location where your html file is there. this anchor tag will execute the (test. bat) batch file. After clicking on the link <TEST>, you will get the window prompting to open/save/close, if you will click on open then batch file will be executed.
You can write a .bat
file containing:
cd <location of your django project>
<location of python.exe> manage.py runserver
I believe that should suffice.
As Miguel said, you can write the below lines:
cd <location of your django project>
<location of python.exe> manage.py runserver
in a file and save it as somefilename.bat, thats it. Now, its a batch file and clicking on it would execute it i.e. your runserver command.
What do you mean by batch file scripting?
Miguel and Ankit already answered you. I just followed it and it worked. Here is my complete offeronline.bat
D:
cd user\shumon\offeronline
manage.py runserver
My Django project and python files are in the D drive.
D:
changes the current directory to Dcd ...
changes the current directory to the exact location of the project.manage.py runserver
runs the server.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With