-
We assume the following project structure:
- MyProject/ - .git/ - myproject/ - settings.py - wsgi.py - myapp1/ - static/ - app.py - models.py - ... - myapp2/ - ... - myapp3/ - ... - uploads/ - # uploaded files stored here - .gitignore - manage.py
Notice: we use
MyProject
vsmyproject
for simplicity. -
The project is published as a public git repo online, for example via github:
Make sure pipenv
is installed globally on your development machine. To install pipenv
:
-
On Windows: Run the following (when no virtualenv is activated!!! You might need to run this as an administrator.)
pip install pipenv
-
On other platforms: https://docs.pipenv.org/install/#installing-pipenv
-
Install some dependencies with
pipenv install
. Some recommended packages are:-
django
: 😎 (required). -
psycopg2
: for using postgres (required). -
ipython
: a great python shell (Highly recommended). -
django-extensions
: for example forshell_plus
(Highly recommended).
(To install, make sure to add"django_extensions",
toINSTALLED_APPS
). -
Pillow
: for image manipulation (optional - for working with uploaded images). -
djangorestframework
: for building REST APIs (optional). -
For example:
pipenv install django psycopg2 ipython django-extensions Pillow djangorestframework
-
-
(Note: If you already have an existing
requirements.txt
file, just runpipenv install
to magically convert it to aPipfile
!. Make sure to edit thePipfile
to change version numbers to"*"
) -
This command...
-
... will create a virtualenv (it will display its location on the screen).
-
... will create a
Pipfile
, similar to:[[source]] url = "https://pypi.python.org/simple" verify_ssl = true name = "pypi" [packages] django = "*" psycopg2 = "*" pytz = "*" pillow = "*" djangorestframework = "*" ipython = "*" django-extensions = "*" [dev-packages]
-
...will create a
Pipfile.lock
file with information on current versions installed.
-
-
Use the following command to create a
requirements.txt
file that can be easily used later bypip
(withoutpipenv
) on your server:pipenv lock -r > requirements.txt
-
Add these files to your git repo:
git add Pipfile Pipfile.lock requirements.txt