Skip to content

Commit 0add3d8

Browse files
pyup-botagconti
authored andcommitted
Update django to 2.0 (#504)
* Update django from 1.11.8 to 2.0 * docs(README): update punctuation * docs: update django doc references to 2.0 * ci(travis): show depreciation warnings at cookiecutter level * refactor(manage.py): move to root * fix(cookiecutter): update imports to be relative to app * refactor(cookiecutter/urls): upgrade to path and re_path * fix(.travis): use root manage.py * ci(travis): added heroku credentials * Revert "ci(travis): added heroku credentials" This reverts commit d4cd973. * fix(manage): add app path * chore(cookiecutter): add missing __init__ * fix(config/local): cover package with app name * fix(config/common): add base_dir back * chore(users/migrations): add last_name migration added by django 2.0 * ci(.travis): try without init * fix(urls): revert static import * fix(Dockerfile): execute manage.py * fix(requirements): add gunicorn back in * fix(docker-compose): tag web image again * docs(README): qualify apis
1 parent 7b50d83 commit 0add3d8

18 files changed

Lines changed: 57 additions & 39 deletions

File tree

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ install:
1111
script:
1212
- docker-compose run --rm web bash -c "flake8 . &&
1313
python wait_for_postgres.py &&
14-
./piedpiper/manage.py test"
14+
python -Wall ./manage.py test"
1515
notifications:
1616
email: false
1717
cache:

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<p align="center">
22
<img width="64" src="media/cdr-icon.png" alt="cookiecutter-django-rest" >
33
<h3 align="center">cookiecutter-django-rest</h3>
4-
<p align="center">A factory for building bleeding edge, best practiced, scalable, apis<p>
4+
<p align="center">a factory for building bleeding edge, best practiced, scalable, rest apis<p>
55
<p align="center">
66
<a href="https://travis-ci.org/agconti/cookiecutter-django-rest">
77
<img src="https://travis-ci.org/agconti/cookiecutter-django-rest.svg?branch=master" alt="Build Status">
@@ -22,13 +22,13 @@ You need to make a scalable api on a deadline. You deeply care about the quality
2222

2323
## Highlights
2424
- Modern Python development with Python 3.6+
25-
- Bleeding edge Django 1.11+
25+
- Bleeding edge Django 2.0+
2626
- Fully dockerized, local development via docker-compose.
2727
- PostgreSQL 9.6+
28-
- Start off with 100% test coverage, [continuous integration](https://github.com/agconti/cookiecutter-django-rest/blob/master/%7B%7Bcookiecutter.github_repository_name%7D%7D/.travis.yml), and continuous deployment.
28+
- Start off with full test coverage, [continuous integration](https://github.com/agconti/cookiecutter-django-rest/blob/master/%7B%7Bcookiecutter.github_repository_name%7D%7D/.travis.yml), and continuous deployment.
2929
- Complete [Django Rest Framework](http://www.django-rest-framework.org/) integration
3030
- Auto deployment to Heroku included. Also since we're using containers we can easily deploy anywhere.
31-
- Always current dependencies and security updates enforced by [pyup.io](https://pyup.io/)
31+
- Always current dependencies and security updates enforced by [pyup.io](https://pyup.io/).
3232
- A slim but robust foundation -- just enough to maximize your productivity, nothing more.
3333

3434
## Quick Start

{{cookiecutter.github_repository_name}}/.coveragerc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ omit = *migrations*,
44
*urls*,
55
*test*,
66
*admin*,
7+
./manage.py,
78
./{{ cookiecutter.app_name }}/config/*,
8-
./{{ cookiecutter.app_name }}/manage.py,
99
./{{ cookiecutter.app_name }}/wsgi.py,
1010
*__init__*

{{cookiecutter.github_repository_name}}/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,5 +100,8 @@ venv.bak/
100100
# mkdocs documentation
101101
/site
102102

103+
# django staticfiles
104+
/static
105+
103106
# mypy
104107
.mypy_cache/

{{cookiecutter.github_repository_name}}/.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ before_script:
99
script:
1010
- docker-compose run --rm web bash -c "flake8 . &&
1111
python wait_for_postgres.py &&
12-
./{{cookiecutter.app_name}}/manage.py test"
12+
./manage.py test"
1313

1414
after_success:
1515
- if [ "$TRAVIS_BRANCH" == "master" ]; then

{{cookiecutter.github_repository_name}}/Dockerfile

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,6 @@ WORKDIR /code
1212
EXPOSE 8000
1313

1414
# Migrates the database, uploads staticfiles, and runs the production server
15-
CMD /{{cookiecutter.app_name}}/manage.py migrate && \
16-
/{{cookiecutter.app_name}}/manage.py collectstatic --noinput && \
17-
newrelic-admin run-program gunicorn \
18-
--pythonpath="./{{cookiecutter.app_name}}" \
19-
--bind 0.0.0.0:$PORT \
20-
--log-file - \
21-
wsgi:application
15+
CMD ./manage.py migrate && \
16+
./manage.py collectstatic --noinput && \
17+
newrelic-admin run-program gunicorn --bind 0.0.0.0:$PORT --log-file - {{cookiecutter.app_name}}.wsgi:application

{{cookiecutter.github_repository_name}}/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
Create a superuser to login to the admin:
1717

1818
```bash
19-
docker-compose run --rm web ./{{cookiecutter.app_name}}/manage.py createsuperuser
19+
docker-compose run --rm web ./manage.py createsuperuser
2020
```
2121

2222
Start the dev server for local development:

{{cookiecutter.github_repository_name}}/docker-compose.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,11 @@ services:
77
restart: always
88
environment:
99
- DJANGO_SECRET_KEY=local
10+
image: web
1011
build: ./
1112
command: >
12-
bash -c "./{{ cookiecutter.app_name }}/manage.py migrate &&
13-
./{{ cookiecutter.app_name }}/manage.py runserver 0.0.0.0:8000"
13+
bash -c "./manage.py migrate &&
14+
./manage.py runserver 0.0.0.0:8000"
1415
volumes:
1516
- ./:/code
1617
ports:

{{cookiecutter.github_repository_name}}/docs/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ docker-compose up
2222
Create a superuser to login to the admin:
2323

2424
```bash
25-
docker-compose run --rm web ./{{cookiecutter.app_name}}/manage.py createsuperuser
25+
docker-compose run --rm web ./manage.py createsuperuser
2626
```
2727

2828

{{cookiecutter.github_repository_name}}/{{cookiecutter.app_name}}/manage.py renamed to {{cookiecutter.github_repository_name}}/manage.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import sys
44

55
if __name__ == "__main__":
6-
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config")
6+
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "{{ cookiecutter.app_name }}.config")
77
os.environ.setdefault("DJANGO_CONFIGURATION", "Local")
88

99
try:

0 commit comments

Comments
 (0)