Skip to content

Instantly share code, notes, and snippets.

@smjaberl
Last active March 30, 2020 00:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save smjaberl/771211f5bd8114b936807e25aa0a7177 to your computer and use it in GitHub Desktop.
Save smjaberl/771211f5bd8114b936807e25aa0a7177 to your computer and use it in GitHub Desktop.
Django as Protable App

Django as Protable App for Windows 10

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.

  1. 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/

  2. Create a directory namened winpy and extract/install the WinPython enviroment to this folder. Now there should be WPy64-3760 directory in "winpy"

  3. Create a directory namened "django" and copy your code into this folder. The manage.py file should exists at django/manage.py.

  4. Copy the requirements.txt into the winpy folder.

  5. 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

  6. 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/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment