Half the battle to create a successful project is getting everything organized. This is a Github template repository for a reusable Django app that can be released on PyPi.
- Development with black so everybody gets the code formatting rules they deserve
- Development with flake8 so people using ed get syntax checking
- Development with isort for automatically sorting imports
- Development with mypy for type-hinting to catch errors
- Testing with pytest and FactoryBoy:
- Manage versions with bump-my-version - for semantic or calendar version numbers
- Manage dependencies with pip-tools
This is a GitHub template repository. Simply create a new repository from it or open it in a Code Space. The repository will contain a single commit.
After you checkout your repository, the first step is to rename the app:
./bin/rename-app myappNext, build the virtualenv and install all the dependencies. This will also build the library containing the app:
python3 -m venv .venv
source .venv/bin/activate
pip install --upgrade pip setuptools wheel
pip install pip-toolsOptional. The project is shipped with pinned versions for the dependencies. If you want to upgrade to the latest versions then recompile the requirements source files:
pip-compile --upgrade requirements/dev.in
pip-compile --upgrade requirements/docs.in
pip-compile --upgrade requirements/tests.inInstall the dependencies:
pip-sync requirements/dev.txtRun the tests:
pytestRun the django server:
./manage.py runserverOpen a browser and visit http://localhost:8000 and, voila, we have a working site. Well cover the deployment later.