Skip to content

Commit 2cd616d

Browse files
committed
Initial commit
0 parents  commit 2cd616d

32 files changed

+1092
-0
lines changed

.gitignore

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
*.log
2+
*.pot
3+
*.pyc
4+
.idea/
5+
6+
{{ cookiecutter.project_slug }}/Pipfile.lock
7+
todo_project_name/

.travis.yml

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
language: python
2+
3+
python:
4+
- 3.6
5+
6+
sudo: false
7+
8+
cache: pip
9+
10+
env:
11+
- PIPENV_IGNORE_VIRTUALENVS=1
12+
13+
install:
14+
- pip install -U pip wheel
15+
- make requirements
16+
17+
script:
18+
- make test

LICENSE.txt

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Copyright {% now 'utc', '%Y' %} {{ cookie_cutter.author_name }}
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4+
5+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6+
7+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Makefile

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
.DEFAULT_GOAL := test
2+
3+
.PHONY: requirements test
4+
5+
requirements:
6+
pip install -r requirements.txt
7+
# TODO Restore once https://github.com/pypa/pipenv/issues/3224 is released
8+
# pip install pipenv
9+
pip install git+https://github.com/pypa/pipenv
10+
11+
test:
12+
# Remove any existing data
13+
rm -rf todo_project_name
14+
15+
# Create a new project with the default values
16+
cookiecutter . --no-input
17+
18+
# Execute the project's Make targets
19+
cd todo_project_name && make production-requirements requirements
20+
cd todo_project_name && SECRET_KEY=fake DATABASE_URL="sqlite://:memory:" pipenv run make detect_missing_migrations
21+
cd todo_project_name && SECRET_KEY=fake DATABASE_URL="sqlite://:memory:" pipenv run make migrate
22+
cd todo_project_name && pipenv run make validate
23+
cd todo_project_name && pipenv run make static

README.rst

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
Cookiecutter Django |Travis|_
2+
=============================
3+
.. |Travis| image:: https://travis-ci.org/clintonb/cookiecutter-django.svg?branch=master
4+
.. _Travis: https://travis-ci.org/clintonb/cookiecutter-django
5+
6+
7+
This project is a `Cookiecutter <https://cookiecutter.readthedocs.io/en/latest/>`_ template for Django projects. It is
8+
intentionally lighter than more popular templates to allow for future flexibility.
9+
10+
Features
11+
--------
12+
* Django 2.1.x
13+
* Support for Python 3.6+
14+
* `12-Factor <https://12factor.net/>`_ based settings via `django-environ <https://django-environ.readthedocs.io/en/latest/>`_
15+
* Custom user model
16+
17+
18+
Usage
19+
-----
20+
1. Install Cookiecutter::
21+
22+
$ pip install cookiecutter
23+
24+
2. Run Cookiecutter, and enter details when prompted::
25+
26+
$ cookiecutter https://github.com/clintonb/cookiecutter-django
27+

cookiecutter.json

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"project_name": "todo-project-name",
3+
"project_slug": "{{ cookiecutter.project_name.lower()|replace(' ', '_')|replace('-', '_')|replace('.', '_')|trim() }}",
4+
"description": "todo-project-description",
5+
"author_name": "todo-author-name"
6+
}

requirements.txt

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
cookiecutter
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[run]
2+
branch=True
3+
source={{ cookiecutter.project_slug }}
4+
omit =
5+
{{ cookiecutter.project_slug }}/settings*
6+
{{ cookiecutter.project_slug }}/conf*
7+
*conftest.py
8+
*wsgi.py
9+
*migrations*
10+
*admin.py
11+
*static*
12+
*templates*
+150
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
6+
# C extensions
7+
*.so
8+
9+
# Distribution / packaging
10+
.Python
11+
build/
12+
develop-eggs/
13+
dist/
14+
downloads/
15+
eggs/
16+
.eggs/
17+
lib/
18+
lib64/
19+
parts/
20+
sdist/
21+
var/
22+
wheels/
23+
share/python-wheels/
24+
*.egg-info/
25+
.installed.cfg
26+
*.egg
27+
MANIFEST
28+
29+
# PyInstaller
30+
# Usually these files are written by a python script from a template
31+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
32+
*.manifest
33+
*.spec
34+
35+
# Installer logs
36+
pip-log.txt
37+
pip-delete-this-directory.txt
38+
39+
# Unit test / coverage reports
40+
htmlcov/
41+
.tox/
42+
.nox/
43+
.coverage
44+
.coverage.*
45+
.cache
46+
nosetests.xml
47+
coverage.xml
48+
*.cover
49+
.hypothesis/
50+
.pytest_cache/
51+
52+
# Translations
53+
*.mo
54+
*.pot
55+
56+
# Django stuff:
57+
*.log
58+
local_settings.py
59+
db.sqlite3
60+
61+
# Flask stuff:
62+
instance/
63+
.webassets-cache
64+
65+
# Scrapy stuff:
66+
.scrapy
67+
68+
# Sphinx documentation
69+
docs/_build/
70+
71+
# PyBuilder
72+
target/
73+
74+
# Jupyter Notebook
75+
.ipynb_checkpoints
76+
77+
# IPython
78+
profile_default/
79+
ipython_config.py
80+
81+
# pyenv
82+
.python-version
83+
84+
# celery beat schedule file
85+
celerybeat-schedule
86+
87+
# SageMath parsed files
88+
*.sage.py
89+
90+
# Environments
91+
.env
92+
.venv
93+
env/
94+
venv/
95+
ENV/
96+
env.bak/
97+
venv.bak/
98+
99+
# Spyder project settings
100+
.spyderproject
101+
.spyproject
102+
103+
# Rope project settings
104+
.ropeproject
105+
106+
# mkdocs documentation
107+
/site
108+
109+
# mypy
110+
.mypy_cache/
111+
.dmypy.json
112+
dmypy.json
113+
114+
# Pyre type checker
115+
.pyre/
116+
117+
# Visual Studio Code
118+
.vscode/*
119+
!.vscode/settings.json
120+
!.vscode/tasks.json
121+
!.vscode/launch.json
122+
!.vscode/extensions.json
123+
124+
# JetBrains PyCharm
125+
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
126+
127+
# User-specific stuff
128+
.idea/**/workspace.xml
129+
.idea/**/tasks.xml
130+
.idea/**/usage.statistics.xml
131+
.idea/**/dictionaries
132+
.idea/**/shelf
133+
134+
# Generated files
135+
.idea/**/contentModel.xml
136+
137+
# Sensitive or high-churn files
138+
.idea/**/dataSources/
139+
.idea/**/dataSources.ids
140+
.idea/**/dataSources.local.xml
141+
.idea/**/sqlDataSources.xml
142+
.idea/**/dynamic.xml
143+
.idea/**/uiDesigner.xml
144+
.idea/**/dbnavigator.xml
145+
146+
# Editor-based Rest Client
147+
.idea/httpRequests
148+
149+
# Docs output
150+
docs/_build/
+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
.DEFAULT_GOAL := test
2+
3+
.PHONY: clean help requirements test validate quality production-requirements migrate static clean_static
4+
5+
# Generates a help message. Borrowed from https://github.com/pydanny/cookiecutter-djangopackage.
6+
help: ## Display this help message
7+
@echo "Please use \`make <target>\` where <target> is one of"
8+
@perl -nle'print $& if m{^[\.a-zA-Z_-]+:.*?## .*$$}' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m %-25s\033[0m %s\n", $$1, $$2}'
9+
10+
11+
clean: ## Delete generated byte code and coverage reports
12+
find . -name '*.pyc' -delete
13+
coverage erase
14+
15+
requirements: ## Install requirements for local development
16+
pipenv install --dev
17+
18+
production-requirements: ## Install requirements for production
19+
pipenv install
20+
21+
test: clean ## Run tests and generate coverage report
22+
SECRET_KEY=fake DATABASE_URL="sqlite://:memory:" coverage run -m pytest --durations=25 -v
23+
coverage report -m
24+
25+
quality: ## Run pep8 and Pylint
26+
isort --check-only --recursive {{ cookiecutter.project_slug }}/
27+
pycodestyle {{ cookiecutter.project_slug }} *.py
28+
pylint --rcfile=pylintrc {{ cookiecutter.project_slug }} *.py
29+
30+
validate: quality test ## Run tests and quality checks
31+
32+
detect_missing_migrations: ## Determine if any apps are missing generated migrations
33+
SECRET_KEY=fake DATABASE_URL="sqlite://:memory:" python manage.py makemigrations --check --dry-run || (echo "Migration files are missing. Please run the "makemigrations" management command, and commit the migrations." && false)
34+
35+
migrate: ## Apply database migrations
36+
SECRET_KEY=fake python manage.py migrate --noinput
37+
38+
static: ## Gather all static assets for production
39+
SECRET_KEY=fake DATABASE_URL="sqlite://:memory:" python manage.py collectstatic --noinput
40+
41+
clean_static: ## Remove all generated static files
42+
rm -rf {{ cookiecutter.project_slug }}/public/
+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
[[source]]
2+
3+
url = "https://pypi.python.org/simple"
4+
verify_ssl = true
5+
name = "pypi"
6+
7+
8+
[packages]
9+
django = "~=2.1.3"
10+
django-environ = "~=0.4"
11+
django-extensions = "~=2.1"
12+
django-model-utils = "~=3.1"
13+
gevent = "~=1.3"
14+
gunicorn = "~=19.9"
15+
"psycopg2-binary" = "~=2.7"
16+
17+
18+
[dev-packages]
19+
coverage = "~=4.5"
20+
django-debug-toolbar = "~=1.10"
21+
factory-boy = "~=2.11"
22+
isort = "~=4.3"
23+
mypy = "~=0.641"
24+
pycodestyle = "~=2.4"
25+
pylint = "~=2.1"
26+
pylint-django = "~=2.0"
27+
pytest-django = "~=3.4"
28+
29+
30+
[requires]
31+
python_version = "3.6"
+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{{cookiecutter.project_name}} |Travis|_ |Codecov|_
2+
===================================================
3+
.. |Travis| image:: https://travis-ci.org/TODO/{{cookiecutter.project_name}}.svg?branch=master
4+
.. _Travis: https://travis-ci.org/TODO/{{cookiecutter.project_name}}
5+
6+
.. |Codecov| image:: http://codecov.io/github/TODO/{{cookiecutter.project_name}}/coverage.svg?branch=master
7+
.. _Codecov: http://codecov.io/github/TODO/{{cookiecutter.project_name}}?branch=master
8+
9+
TODO The ``README.rst`` file should start with a brief description of the project.
10+
11+
Documentation
12+
-------------
13+
.. |ReadtheDocs| image:: https://readthedocs.org/projects/{{cookiecutter.project_name}}/badge/?version=latest
14+
.. _ReadtheDocs: http://{{cookiecutter.project_name}}.readthedocs.io/en/latest/
15+
16+
TODO Publish to Read The Docs!
17+
`Documentation <https://{{cookiecutter.project_name}}.readthedocs.io/en/latest/>`_ is hosted on Read the Docs. The source is hosted in this repo's `docs <https://github.com/edx/{{cookiecutter.project_name}}/tree/master/docs>`_ directory. To contribute, please open a PR against this repo.
18+
19+
How To Contribute
20+
-----------------
21+
22+
TODO Describe how others can contribute to this project.
23+
Contributions are welcome. Do this...
24+
25+
Reporting Security Issues
26+
-------------------------
27+
28+
TODO Describe how people can report security issues.
29+
Please do not report security issues in public. Please email...
30+
31+
Get Help
32+
--------
33+
34+
TODO Describe where/how others can get support for running, or contributing to, this project.
35+
Ask questions and discuss this project on Slack or a mailing list...
+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/usr/bin/env python
2+
import os
3+
import sys
4+
5+
if __name__ == '__main__':
6+
os.environ.setdefault('DJANGO_SETTINGS_MODULE', '{{ cookiecutter.project_slug }}.settings')
7+
try:
8+
from django.core.management import execute_from_command_line
9+
except ImportError as exc:
10+
raise ImportError(
11+
"Couldn't import Django. Are you sure it's installed and "
12+
"available on your PYTHONPATH environment variable? Did you "
13+
"forget to activate a virtual environment?"
14+
) from exc
15+
execute_from_command_line(sys.argv)

0 commit comments

Comments
 (0)