In some cases it is necessary to devliver a django project to a person who doesn't know much about computers. In this case it is nice to have a python eviroment ready to use inclusive the code, so that you just have to sent a zip file. Below I deiscribe how to setup a WinPy enviroment and adding a django project. With a one line batchfile it should be very easy to start the django testserver.
-
Download a minmal WinPython environment. This should be ~ 23 MB. I took the Winpython64-3.7.6.0dot.exe from 2019-12-22. https://sourceforge.net/projects/winpython/files/WinPython_3.7/3.7.6.0/
-
Create a directory namened
winpy
and extract/install the WinPython enviroment to this folder. Now there should beWPy64-3760
directory in "winpy" -
Create a directory namened "django" and copy your code into this folder. The
manage.py
file should exists atdjango/manage.py
. -
Copy the requirements.txt into the
winpy
folder. -
Now open the "WinPython Command Prompt" and install your enviroment with:
C:\Users\win10\winpy\WPy64-3760\scripts> pip install -r ..\..\requirements.txt
Be sure, that you type the right path to the requirements.txt
-
Create a batch file to start the django server. The file
runDjango.bat
should be stored in the winpy folder. Just write this line into the file.content of runDjango.bat WPy64-3760\scripts\python.bat WPy64-3760\django\manage.py runserver localhost:80
If you start this file the Django testserver shold be start at Port 80.
Now you can share the winpy Folder e.g. as a zip with other useres.
This users do not have to install anythink on their Windows 10.
They just extract the zip, start the batchfile and enjoy the django app with the browser on localhost/