Skip to content

The template I use to create reusable Django apps.

License

Notifications You must be signed in to change notification settings

StuartMacKay/django-app-template

Repository files navigation

Django App Template

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.

Features

  • 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

Quick start

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 myapp

Next, 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-tools

Optional. 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.in

Install the dependencies:

pip-sync requirements/dev.txt

Run the tests:

pytest

Run the django server:

./manage.py runserver

Open a browser and visit http://localhost:8000 and, voila, we have a working site. Well cover the deployment later.

About

The template I use to create reusable Django apps.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published