cookiecutter-sveetch-djangoapp |
Yet another Cookiecutter template to produce a repository to start a Django application package with Python3.
It emphases on simple package with quality and not any relation to any service (state badge, pyup, travis, etc..) except Read the Docs link in README.
A sample built from this template is available on repository sveetch-djangoapp-sample.
Just invoke the Cookiecutter template to create a new project: :
cookiecutter https://github.com/sveetch/cookiecutter-sveetch-djangoapp.git
- Package content
A Django package with everything to start:
- Development in a Python virtual environment with virtualenv and pip;
- Promote Test Driven Development with Pytest;
- Last Django versions support;
- Configuration in
setup.cfg
ready to upload package to Pypi; - Sample blog application (very very minimalist) fully tested;
- Flake8 configuration for quality review;
- tox configuration for environments tests;
- Code is fully documented with reStructuredText and Napoleon extension for Sphinx.
- Release with twine.
Package cover some basic features:
- A very minimalist Blog application for sample;
- Basic generic views usage;
- Testing models, factories and views;
- pyquery usage for tests on HTML contents;
- About first project install and model migrations
Created project have models but no migrations. This is to avoid creating migration for models you will surely change or remove.
This will result in failures on tests and running application until you have created initial migrations. There is a makefile action for this: :
make migrations
It will automatically search to create new migrations for your application if there is some changes or new models. When done, there is a makefile action to apply new migrations: :
make migrate
So if you just plan to check created package, just performs migration creation. However if you plan to create your own application, create your models and make migrations once finished.
But remember until you've done migrations, tests will fails.
- Package requirements
To use it from repository url you just need Cookiecutter.
Once project is created, you can install it locally with
make install
from project directory.However you can install this cookie locally (to avoid doing request each time you use it), you will need virtualenv, clone it where you want and use its
make install
command. Once installed you can create shortcut with a bash alias in your.bash_aliases
: :alias cookdjango='/home/your/install/cookiecutter-sveetch-django/.venv/bin/cookiecutter /home/your/install/cookiecutter-sveetch-django'
- Naming
For a given
Sample bar
project name:- Package name will be
sample-bar
; - Application name will
sample_bar
;
You can change package and application names during project creation.
- Package name will be
- Options
You can define author full name, email, github username, pypi username, version start, package name and package short description.
Some of these have a default value filled from a previous value, obviously you can edit it to your own needs.
You can pre define some options in your cookiecutter user configuration to avoid to input them each time you use this cookie. This is especially recommended for the author and username ones.