Merge branch 'master' into 1639-split-issue-templates-by-categories

This commit is contained in:
Nikita P. Shupeyko 2018-05-23 10:42:07 +03:00
commit 4a22100cf8
46 changed files with 210 additions and 368 deletions

View File

@ -141,6 +141,7 @@ Listed in alphabetical order.
Roman Afanaskin `@siauPatrick`_ Roman Afanaskin `@siauPatrick`_
Roman Osipenko `@romanosipenko`_ Roman Osipenko `@romanosipenko`_
Russell Davies Russell Davies
Sascha `@saschalalala` @saschalalala
Sam Collins `@MightySCollins`_ Sam Collins `@MightySCollins`_
Shupeyko Nikita `@webyneter`_ Shupeyko Nikita `@webyneter`_
Sławek Ehlert `@slafs`_ Sławek Ehlert `@slafs`_

View File

@ -158,13 +158,13 @@ Answer the prompts with your own desired options_. For example::
domain_name [example.com]: myreddit.com domain_name [example.com]: myreddit.com
version [0.1.0]: 0.0.1 version [0.1.0]: 0.0.1
timezone [UTC]: America/Los_Angeles timezone [UTC]: America/Los_Angeles
use_whitenoise [y]: n use_whitenoise [n]: n
use_celery [n]: y use_celery [n]: y
use_mailhog [n]: n use_mailhog [n]: n
use_sentry [y]: y use_sentry [n]: y
use_pycharm [n]: y use_pycharm [n]: y
windows [n]: n windows [n]: n
use_docker [y]: n use_docker [n]: n
use_heroku [n]: y use_heroku [n]: y
use_compressor [n]: y use_compressor [n]: y
Select postgresql_version: Select postgresql_version:

View File

@ -3,8 +3,8 @@
"project_slug": "{{ cookiecutter.project_name.lower()|replace(' ', '_')|replace('-', '_') }}", "project_slug": "{{ cookiecutter.project_name.lower()|replace(' ', '_')|replace('-', '_') }}",
"description": "Behold My Awesome Project!", "description": "Behold My Awesome Project!",
"author_name": "Daniel Roy Greenfeld", "author_name": "Daniel Roy Greenfeld",
"email": "{{ cookiecutter.author_name.lower()|replace(' ', '-') }}@example.com",
"domain_name": "example.com", "domain_name": "example.com",
"email": "{{ cookiecutter.author_name.lower()|replace(' ', '-') }}@example.com",
"version": "0.1.0", "version": "0.1.0",
"open_source_license": [ "open_source_license": [
"MIT", "MIT",
@ -28,15 +28,14 @@
], ],
"js_task_runner": [ "js_task_runner": [
"None", "None",
"Gulp", "Gulp"
"Grunt"
], ],
"custom_bootstrap_compilation": "n", "custom_bootstrap_compilation": "n",
"use_compressor": "n", "use_compressor": "n",
"use_celery": "n", "use_celery": "n",
"use_mailhog": "n", "use_mailhog": "n",
"use_sentry": "y", "use_sentry": "n",
"use_whitenoise": "y", "use_whitenoise": "n",
"use_heroku": "n", "use_heroku": "n",
"use_travisci": "n", "use_travisci": "n",
"keep_local_envs_in_vcs": "y", "keep_local_envs_in_vcs": "y",

View File

@ -18,7 +18,7 @@ Run these commands to deploy the project to Heroku:
heroku config:set WEB_CONCURRENCY=4 heroku config:set WEB_CONCURRENCY=4
# Generating a 32 character-long random string without any of the visually similiar characters "IOl01": # Generating a 32 character-long random string without any of the visually similiar characters "IOl01":
heroku config:set DJANGO_ADMIN_URL="^$(openssl rand -base64 4096 | tr -dc 'A-HJ-NP-Za-km-z2-9' | head -c 32)/" heroku config:set DJANGO_ADMIN_URL="$(openssl rand -base64 4096 | tr -dc 'A-HJ-NP-Za-km-z2-9' | head -c 32)/"
heroku config:set DJANGO_SECRET_KEY="$(openssl rand -base64 64)" heroku config:set DJANGO_SECRET_KEY="$(openssl rand -base64 64)"
heroku config:set DJANGO_SETTINGS_MODULE=config.settings.production heroku config:set DJANGO_SETTINGS_MODULE=config.settings.production
heroku config:set DJANGO_ALLOWED_HOSTS='.herokuapp.com' heroku config:set DJANGO_ALLOWED_HOSTS='.herokuapp.com'
@ -33,6 +33,7 @@ Run these commands to deploy the project to Heroku:
heroku config:set PYTHONHASHSEED=random heroku config:set PYTHONHASHSEED=random
git push heroku master git push heroku master
heroku run python manage.py migrate
heroku run python manage.py check --deploy heroku run python manage.py check --deploy
heroku run python manage.py createsuperuser heroku run python manage.py createsuperuser
heroku open heroku open

View File

@ -84,6 +84,10 @@ Once this is ready, you can run it with::
docker-compose -f production.yml up docker-compose -f production.yml up
To run the stack and detach the containers, run::
docker-compose -f production.yml up -d
To run a migration, open up a second terminal and run:: To run a migration, open up a second terminal and run::
docker-compose -f production.yml run --rm django python manage.py migrate docker-compose -f production.yml run --rm django python manage.py migrate

View File

@ -1,31 +1,31 @@
Project Generation Options Project Generation Options
========================== ==========================
project_name [My Awesome Project]: project_name:
Your project's human-readable name, capitals and spaces allowed. Your project's human-readable name, capitals and spaces allowed.
project_slug [my_awesome_project]: project_slug:
Your project's slug without dashes or spaces. Used to name your repo Your project's slug without dashes or spaces. Used to name your repo
and in other places where a Python-importable version of your project name and in other places where a Python-importable version of your project name
is needed. is needed.
description [Behold My Awesome Project!] description:
Describes your project and gets used in places like ``README.rst`` and such. Describes your project and gets used in places like ``README.rst`` and such.
author_name [Daniel Roy Greenfeld]: author_name:
This is you! The value goes into places like ``LICENSE`` and such. This is you! The value goes into places like ``LICENSE`` and such.
email [daniel-roy-greenfeld@example.com]: email:
The email address you want to identify yourself in the project. The email address you want to identify yourself in the project.
domain_name [example.com] domain_name:
The domain name you plan to use for your project once it goes live. The domain name you plan to use for your project once it goes live.
Note that it can be safely changed later on whenever you need to. Note that it can be safely changed later on whenever you need to.
version [0.1.0] version:
The version of the project at its inception. The version of the project at its inception.
open_source_license [1] open_source_license:
A software license for the project. The choices are: A software license for the project. The choices are:
1. MIT_ 1. MIT_
@ -34,19 +34,19 @@ open_source_license [1]
4. `Apache Software License 2.0`_ 4. `Apache Software License 2.0`_
5. Not open source 5. Not open source
timezone [UTC] timezone:
The value to be used for the ``TIME_ZONE`` setting of the project. The value to be used for the ``TIME_ZONE`` setting of the project.
windows [n] windows:
Indicates whether the project should be configured for development on Windows. Indicates whether the project should be configured for development on Windows.
use_pycharm [n] use_pycharm:
Indicates whether the project should be configured for development with PyCharm_. Indicates whether the project should be configured for development with PyCharm_.
use_docker [y] use_docker:
Indicates whether the project should be configured to use Docker_ and `Docker Compose`_. Indicates whether the project should be configured to use Docker_ and `Docker Compose`_.
postgresql_version [1] postgresql_version:
Select a PostgreSQL_ version to use. The choices are: Select a PostgreSQL_ version to use. The choices are:
1. 10.3 1. 10.3
@ -57,46 +57,45 @@ postgresql_version [1]
6. 9.4 6. 9.4
7. 9.3 7. 9.3
js_task_runner [1] js_task_runner:
Select a JavaScript task runner. The choices are: Select a JavaScript task runner. The choices are:
1. Gulp_ 1. None
2. Grunt_ 2. Gulp_
3. None
custom_bootstrap_compilation [n] custom_bootstrap_compilation:
Indicates whether the project should support Bootstrap recompilation Indicates whether the project should support Bootstrap recompilation
via the selected JavaScript task runner's task. This can be useful via the selected JavaScript task runner's task. This can be useful
for real-time Bootstrap variable alteration. for real-time Bootstrap variable alteration.
use_compressor [n] use_compressor:
Indicates whether the project should be configured to use `Django Compressor`_. Indicates whether the project should be configured to use `Django Compressor`_.
use_celery [n] use_celery:
Indicates whether the project should be configured to use Celery_. Indicates whether the project should be configured to use Celery_.
use_mailhog [n] use_mailhog:
Indicates whether the project should be configured to use MailHog_. Indicates whether the project should be configured to use MailHog_.
use_sentry [n] use_sentry:
Indicates whether the project should be configured to use Sentry_. Indicates whether the project should be configured to use Sentry_.
use_whitenoise [y] use_whitenoise:
Indicates whether the project should be configured to use WhiteNoise_. Indicates whether the project should be configured to use WhiteNoise_.
use_heroku [n] use_heroku:
Indicates whether the project should be configured so as to be deployable Indicates whether the project should be configured so as to be deployable
to Heroku_. to Heroku_.
use_travisci [n] use_travisci:
Indicates whether the project should be configured to use `Travis CI`_. Indicates whether the project should be configured to use `Travis CI`_.
keep_local_envs_in_vcs [y] keep_local_envs_in_vcs:
Indicates whether the project's ``.envs/.local/`` should be kept in VCS Indicates whether the project's ``.envs/.local/`` should be kept in VCS
(comes in handy when working in teams where local environment reproducibility (comes in handy when working in teams where local environment reproducibility
is strongly encouraged). is strongly encouraged).
debug [n] debug:
Indicates whether the project should be configured for debugging. Indicates whether the project should be configured for debugging.
This option is relevant for Cookiecutter Django developers only. This option is relevant for Cookiecutter Django developers only.
@ -114,7 +113,6 @@ debug [n]
.. _PostgreSQL: https://www.postgresql.org/docs/ .. _PostgreSQL: https://www.postgresql.org/docs/
.. _Gulp: https://github.com/gulpjs/gulp .. _Gulp: https://github.com/gulpjs/gulp
.. _Grunt: https://github.com/gruntjs/grunt
.. _Django Compressor: https://github.com/django-compressor/django-compressor .. _Django Compressor: https://github.com/django-compressor/django-compressor

View File

@ -18,7 +18,7 @@ DJANGO_READ_DOT_ENV_FILE READ_DOT_ENV_FILE False
======================================= =========================== ============================================== ====================================================================== ======================================= =========================== ============================================== ======================================================================
Environment Variable Django Setting Development Default Production Default Environment Variable Django Setting Development Default Production Default
======================================= =========================== ============================================== ====================================================================== ======================================= =========================== ============================================== ======================================================================
DJANGO_ADMIN_URL n/a r'^admin/' raises error DJANGO_ADMIN_URL n/a 'admin/' raises error
DJANGO_CACHES CACHES (default) locmem redis DJANGO_CACHES CACHES (default) locmem redis
DJANGO_DATABASES DATABASES (default) See code See code DJANGO_DATABASES DATABASES (default) See code See code
DJANGO_DEBUG DEBUG True False DJANGO_DEBUG DEBUG True False

View File

@ -67,12 +67,6 @@ def remove_heroku_files():
os.remove(file_name) os.remove(file_name)
def remove_grunt_files():
file_names = ["Gruntfile.js"]
for file_name in file_names:
os.remove(file_name)
def remove_gulp_files(): def remove_gulp_files():
file_names = ["gulpfile.js"] file_names = ["gulpfile.js"]
for file_name in file_names: for file_name in file_names:
@ -160,7 +154,7 @@ def set_django_admin_url(file_path):
django_admin_url = set_flag( django_admin_url = set_flag(
file_path, file_path,
"!!!SET DJANGO_ADMIN_URL!!!", "!!!SET DJANGO_ADMIN_URL!!!",
formatted="^{}/", formatted="{}/",
length=32, length=32,
using_digits=True, using_digits=True,
using_ascii_letters=True, using_ascii_letters=True,
@ -264,16 +258,11 @@ def main():
if "{{ cookiecutter.keep_local_envs_in_vcs }}".lower() == "y": if "{{ cookiecutter.keep_local_envs_in_vcs }}".lower() == "y":
append_to_gitignore_file("!.envs/.local/") append_to_gitignore_file("!.envs/.local/")
if "{{ cookiecutter.js_task_runner}}".lower() == "gulp": if "{{ cookiecutter.js_task_runner}}".lower() == "none":
remove_grunt_files()
elif "{{ cookiecutter.js_task_runner}}".lower() == "grunt":
remove_gulp_files() remove_gulp_files()
else:
remove_gulp_files()
remove_grunt_files()
remove_packagejson_file() remove_packagejson_file()
if ( if (
"{{ cookiecutter.js_task_runner }}".lower() in ["grunt", "gulp"] "{{ cookiecutter.js_task_runner }}".lower() != "none"
and "{{ cookiecutter.use_docker }}".lower() == "y" and "{{ cookiecutter.use_docker }}".lower() == "y"
): ):
print( print(

View File

@ -11,7 +11,7 @@ mkdir -p .cache/docker
cd .cache/docker cd .cache/docker
# create the project using the default settings in cookiecutter.json # create the project using the default settings in cookiecutter.json
cookiecutter ../../ --no-input --overwrite-if-exists use_docker=y js_task_runner=None cookiecutter ../../ --no-input --overwrite-if-exists use_docker=y
cd my_awesome_project cd my_awesome_project
# run the project's tests # run the project's tests

View File

@ -105,9 +105,6 @@ coverage
# nyc test coverage # nyc test coverage
.nyc_output .nyc_output
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Bower dependency directory (https://bower.io/) # Bower dependency directory (https://bower.io/)
bower_components bower_components

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="JavaScriptSettings">
<option name="languageLevel" value="ES6" />
</component>
</project>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/{{ cookiecutter.project_slug }}.iml" filepath="$PROJECT_DIR$/.idea/{{ cookiecutter.project_slug }}.iml" />
</modules>
</component>
</project>

View File

@ -1,33 +0,0 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Docker: runserver" type="Python.DjangoServer" factoryName="Django server" singleton="true">
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<envs>
<env name="PYTHONUNBUFFERED" value="1" />
<env name="DJANGO_SETTINGS_MODULE" value="config.settings.local" />
</envs>
<option name="SDK_HOME" value="docker-compose://[$PROJECT_DIR$/local.yml]:django/python" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
<option name="IS_MODULE_SDK" value="false" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<module name="{{ cookiecutter.project_slug }}" />
<PathMappingSettings>
<option name="pathMappings">
<list>
<mapping local-root="$PROJECT_DIR$" remote-root="/app" />
</list>
</option>
</PathMappingSettings>
<option name="launchJavascriptDebuger" value="false" />
<option name="port" value="8000" />
<option name="host" value="0.0.0.0" />
<option name="additionalOptions" value="" />
<option name="browserUrl" value="" />
<option name="runTestServer" value="false" />
<option name="runNoReload" value="false" />
<option name="useCustomRunCommand" value="false" />
<option name="customRunCommand" value="" />
<method />
</configuration>
</component>

View File

@ -1,5 +1,6 @@
<component name="ProjectRunConfigurationManager"> <component name="ProjectRunConfigurationManager">
<configuration default="false" name="merge_production_dotenvs_in_dotenv" type="PythonConfigurationType" factoryName="Python" singleton="true"> <configuration default="false" name="merge_production_dotenvs_in_dotenv" type="PythonConfigurationType" factoryName="Python" singleton="true">
<module name="{{ cookiecutter.project_slug }}" />
<option name="INTERPRETER_OPTIONS" value="" /> <option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" /> <option name="PARENT_ENVS" value="true" />
<envs> <envs>
@ -10,7 +11,6 @@
<option name="IS_MODULE_SDK" value="true" /> <option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" /> <option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" /> <option name="ADD_SOURCE_ROOTS" value="true" />
<module name="{{ cookiecutter.project_slug }}" />
<EXTENSION ID="PythonCoverageRunConfigurationExtension" enabled="false" sample_coverage="true" runner="coverage.py" /> <EXTENSION ID="PythonCoverageRunConfigurationExtension" enabled="false" sample_coverage="true" runner="coverage.py" />
<option name="SCRIPT_NAME" value="merge_production_dotenvs_in_dotenv.py" /> <option name="SCRIPT_NAME" value="merge_production_dotenvs_in_dotenv.py" />
<option name="PARAMETERS" value="" /> <option name="PARAMETERS" value="" />

View File

@ -1,17 +1,17 @@
<component name="ProjectRunConfigurationManager"> <component name="ProjectRunConfigurationManager">
<configuration default="false" name="Docker: migrate" type="Python.DjangoServer" factoryName="Django server" singleton="true"> <configuration default="false" name="migrate" type="Python.DjangoServer" factoryName="Django server" singleton="true">
<module name="{{ cookiecutter.project_slug }}" />
<option name="INTERPRETER_OPTIONS" value="" /> <option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" /> <option name="PARENT_ENVS" value="true" />
<envs> <envs>
<env name="PYTHONUNBUFFERED" value="1" /> <env name="PYTHONUNBUFFERED" value="1" />
<env name="DJANGO_SETTINGS_MODULE" value="config.settings.local" /> <env name="DJANGO_SETTINGS_MODULE" value="config.settings.local" />
</envs> </envs>
<option name="SDK_HOME" value="docker-compose://[$PROJECT_DIR$/local.yml]:django/python" /> <option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" /> <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
<option name="IS_MODULE_SDK" value="false" /> <option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" /> <option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" /> <option name="ADD_SOURCE_ROOTS" value="true" />
<module name="{{ cookiecutter.project_slug }}" />
<PathMappingSettings> <PathMappingSettings>
<option name="pathMappings"> <option name="pathMappings">
<list> <list>

View File

@ -0,0 +1,33 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="runserver" type="Python.DjangoServer" factoryName="Django server" singleton="true">
<module name="{{ cookiecutter.project_slug }}" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<envs>
<env name="PYTHONUNBUFFERED" value="1" />
<env name="DJANGO_SETTINGS_MODULE" value="config.settings.local" />
</envs>
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
<option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<PathMappingSettings>
<option name="pathMappings">
<list>
<mapping local-root="$PROJECT_DIR$" remote-root="/app" />
</list>
</option>
</PathMappingSettings>
<option name="launchJavascriptDebuger" value="false" />
<option name="port" value="8000" />
<option name="host" value="0.0.0.0" />
<option name="additionalOptions" value="" />
<option name="browserUrl" value="" />
<option name="runTestServer" value="false" />
<option name="runNoReload" value="false" />
<option name="useCustomRunCommand" value="false" />
<option name="customRunCommand" value="" />
<method />
</configuration>
</component>

View File

@ -1,17 +1,17 @@
<component name="ProjectRunConfigurationManager"> <component name="ProjectRunConfigurationManager">
<configuration default="false" name="Docker: runserver_plus" type="Python.DjangoServer" factoryName="Django server" singleton="true"> <configuration default="false" name="runserver_plus" type="Python.DjangoServer" factoryName="Django server" singleton="true">
<module name="{{ cookiecutter.project_slug }}" />
<option name="INTERPRETER_OPTIONS" value="" /> <option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" /> <option name="PARENT_ENVS" value="true" />
<envs> <envs>
<env name="PYTHONUNBUFFERED" value="1" /> <env name="PYTHONUNBUFFERED" value="1" />
<env name="DJANGO_SETTINGS_MODULE" value="config.settings.local" /> <env name="DJANGO_SETTINGS_MODULE" value="config.settings.local" />
</envs> </envs>
<option name="SDK_HOME" value="docker-compose://[$PROJECT_DIR$/local.yml]:django/python" /> <option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" /> <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
<option name="IS_MODULE_SDK" value="false" /> <option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" /> <option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" /> <option name="ADD_SOURCE_ROOTS" value="true" />
<module name="{{ cookiecutter.project_slug }}" />
<PathMappingSettings> <PathMappingSettings>
<option name="pathMappings"> <option name="pathMappings">
<list> <list>

View File

@ -1,17 +1,17 @@
<component name="ProjectRunConfigurationManager"> <component name="ProjectRunConfigurationManager">
<configuration default="false" name="Docker: tests - all" type="DjangoTestsConfigurationType" factoryName="Django tests" singleton="true"> <configuration default="false" name="tests - all" type="DjangoTestsConfigurationType" factoryName="Django tests" singleton="true">
<module name="{{ cookiecutter.project_slug }}" />
<option name="INTERPRETER_OPTIONS" value="" /> <option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" /> <option name="PARENT_ENVS" value="true" />
<envs> <envs>
<env name="PYTHONUNBUFFERED" value="1" /> <env name="PYTHONUNBUFFERED" value="1" />
<env name="DJANGO_SETTINGS_MODULE" value="config.settings.test" /> <env name="DJANGO_SETTINGS_MODULE" value="config.settings.test" />
</envs> </envs>
<option name="SDK_HOME" value="docker-compose://[$PROJECT_DIR$/local.yml]:django/python" /> <option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" /> <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
<option name="IS_MODULE_SDK" value="true" /> <option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" /> <option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" /> <option name="ADD_SOURCE_ROOTS" value="true" />
<module name="{{ cookiecutter.project_slug }}" />
<EXTENSION ID="PythonCoverageRunConfigurationExtension" enabled="false" sample_coverage="true" runner="coverage.py" /> <EXTENSION ID="PythonCoverageRunConfigurationExtension" enabled="false" sample_coverage="true" runner="coverage.py" />
<PathMappingSettings> <PathMappingSettings>
<option name="pathMappings"> <option name="pathMappings">

View File

@ -1,17 +1,17 @@
<component name="ProjectRunConfigurationManager"> <component name="ProjectRunConfigurationManager">
<configuration default="false" name="Docker: tests - class: TestUser" type="DjangoTestsConfigurationType" factoryName="Django tests" singleton="true"> <configuration default="false" name="tests - class: TestUser" type="DjangoTestsConfigurationType" factoryName="Django tests" singleton="true">
<module name="{{ cookiecutter.project_slug }}" />
<option name="INTERPRETER_OPTIONS" value="" /> <option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" /> <option name="PARENT_ENVS" value="true" />
<envs> <envs>
<env name="PYTHONUNBUFFERED" value="1" /> <env name="PYTHONUNBUFFERED" value="1" />
<env name="DJANGO_SETTINGS_MODULE" value="config.settings.test" /> <env name="DJANGO_SETTINGS_MODULE" value="config.settings.test" />
</envs> </envs>
<option name="SDK_HOME" value="docker-compose://[$PROJECT_DIR$/local.yml]:django/python" /> <option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" /> <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
<option name="IS_MODULE_SDK" value="true" /> <option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" /> <option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" /> <option name="ADD_SOURCE_ROOTS" value="true" />
<module name="{{ cookiecutter.project_slug }}" />
<EXTENSION ID="PythonCoverageRunConfigurationExtension" enabled="false" sample_coverage="true" runner="coverage.py" /> <EXTENSION ID="PythonCoverageRunConfigurationExtension" enabled="false" sample_coverage="true" runner="coverage.py" />
<PathMappingSettings> <PathMappingSettings>
<option name="pathMappings"> <option name="pathMappings">

View File

@ -1,17 +1,17 @@
<component name="ProjectRunConfigurationManager"> <component name="ProjectRunConfigurationManager">
<configuration default="false" name="Docker: tests - file: test_models" type="DjangoTestsConfigurationType" factoryName="Django tests" singleton="true"> <configuration default="false" name="tests - file: test_models" type="DjangoTestsConfigurationType" factoryName="Django tests" singleton="true">
<module name="{{ cookiecutter.project_slug }}" />
<option name="INTERPRETER_OPTIONS" value="" /> <option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" /> <option name="PARENT_ENVS" value="true" />
<envs> <envs>
<env name="PYTHONUNBUFFERED" value="1" /> <env name="PYTHONUNBUFFERED" value="1" />
<env name="DJANGO_SETTINGS_MODULE" value="config.settings.test" /> <env name="DJANGO_SETTINGS_MODULE" value="config.settings.test" />
</envs> </envs>
<option name="SDK_HOME" value="docker-compose://[$PROJECT_DIR$/local.yml]:django/python" /> <option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" /> <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
<option name="IS_MODULE_SDK" value="true" /> <option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" /> <option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" /> <option name="ADD_SOURCE_ROOTS" value="true" />
<module name="{{ cookiecutter.project_slug }}" />
<EXTENSION ID="PythonCoverageRunConfigurationExtension" enabled="false" sample_coverage="true" runner="coverage.py" /> <EXTENSION ID="PythonCoverageRunConfigurationExtension" enabled="false" sample_coverage="true" runner="coverage.py" />
<PathMappingSettings> <PathMappingSettings>
<option name="pathMappings"> <option name="pathMappings">

View File

@ -1,17 +1,17 @@
<component name="ProjectRunConfigurationManager"> <component name="ProjectRunConfigurationManager">
<configuration default="false" name="Docker: tests - module: users" type="DjangoTestsConfigurationType" factoryName="Django tests" singleton="true"> <configuration default="false" name="tests - module: users" type="DjangoTestsConfigurationType" factoryName="Django tests" singleton="true">
<module name="{{ cookiecutter.project_slug }}" />
<option name="INTERPRETER_OPTIONS" value="" /> <option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" /> <option name="PARENT_ENVS" value="true" />
<envs> <envs>
<env name="PYTHONUNBUFFERED" value="1" /> <env name="PYTHONUNBUFFERED" value="1" />
<env name="DJANGO_SETTINGS_MODULE" value="config.settings.test" /> <env name="DJANGO_SETTINGS_MODULE" value="config.settings.test" />
</envs> </envs>
<option name="SDK_HOME" value="docker-compose://[$PROJECT_DIR$/local.yml]:django/python" /> <option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" /> <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
<option name="IS_MODULE_SDK" value="true" /> <option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" /> <option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" /> <option name="ADD_SOURCE_ROOTS" value="true" />
<module name="{{ cookiecutter.project_slug }}" />
<EXTENSION ID="PythonCoverageRunConfigurationExtension" enabled="false" sample_coverage="true" runner="coverage.py" /> <EXTENSION ID="PythonCoverageRunConfigurationExtension" enabled="false" sample_coverage="true" runner="coverage.py" />
<PathMappingSettings> <PathMappingSettings>
<option name="pathMappings"> <option name="pathMappings">

View File

@ -1,17 +1,17 @@
<component name="ProjectRunConfigurationManager"> <component name="ProjectRunConfigurationManager">
<configuration default="false" name="Docker: tests - specific: test_get_absolute_url" type="DjangoTestsConfigurationType" factoryName="Django tests" singleton="true"> <configuration default="false" name="tests - specific: test_get_absolute_url" type="DjangoTestsConfigurationType" factoryName="Django tests" singleton="true">
<module name="{{ cookiecutter.project_slug }}" />
<option name="INTERPRETER_OPTIONS" value="" /> <option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" /> <option name="PARENT_ENVS" value="true" />
<envs> <envs>
<env name="PYTHONUNBUFFERED" value="1" /> <env name="PYTHONUNBUFFERED" value="1" />
<env name="DJANGO_SETTINGS_MODULE" value="config.settings.test" /> <env name="DJANGO_SETTINGS_MODULE" value="config.settings.test" />
</envs> </envs>
<option name="SDK_HOME" value="docker-compose://[$PROJECT_DIR$/local.yml]:django/python" /> <option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" /> <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
<option name="IS_MODULE_SDK" value="true" /> <option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" /> <option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" /> <option name="ADD_SOURCE_ROOTS" value="true" />
<module name="{{ cookiecutter.project_slug }}" />
<EXTENSION ID="PythonCoverageRunConfigurationExtension" enabled="false" sample_coverage="true" runner="coverage.py" /> <EXTENSION ID="PythonCoverageRunConfigurationExtension" enabled="false" sample_coverage="true" runner="coverage.py" />
<PathMappingSettings> <PathMappingSettings>
<option name="pathMappings"> <option name="pathMappings">

View File

@ -3,4 +3,4 @@
<component name="VcsDirectoryMappings"> <component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" /> <mapping directory="$PROJECT_DIR$" vcs="Git" />
</component> </component>
</project> </project>

View File

@ -5,19 +5,32 @@
<configuration> <configuration>
<option name="rootFolder" value="$MODULE_DIR$" /> <option name="rootFolder" value="$MODULE_DIR$" />
<option name="settingsModule" value="config/settings/local.py" /> <option name="settingsModule" value="config/settings/local.py" />
<option name="manageScript" value="manage.py" /> <option name="manageScript" value="$MODULE_DIR$/manage.py" />
<option name="environment" value="&lt;map/&gt;" /> <option name="environment" value="&lt;map/&gt;" />
<option name="doNotUseTestRunner" value="false" />
<option name="trackFilePattern" value="migrations" />
</configuration> </configuration>
</facet> </facet>
</component> </component>
<component name="NewModuleRootManager"> <component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$"> {% if cookiecutter.js_task_runner != 'None' %}
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/node_modules" /> <excludeFolder url="file://$MODULE_DIR$/node_modules" />
</content> </content>
{% else %}
<content url="file://$MODULE_DIR$" />
{% endif %}
<orderEntry type="sourceFolder" forTests="false" /> <orderEntry type="sourceFolder" forTests="false" />
</component> </component>
<component name="PackageRequirementsSettings"> <component name="PackageRequirementsSettings">
<option name="requirementsPath" value="$MODULE_DIR$/requirements/local.txt" /> <option name="requirementsPath" value="$MODULE_DIR$/requirements/local.txt" />
</component>
<component name="PyDocumentationSettings">
<option name="renderExternalDocumentation" value="true" />
</component>
<component name="ReSTService">
<option name="workdir" value="$MODULE_DIR$/docs" />
<option name="DOC_DIR" value="$MODULE_DIR$/docs" />
</component> </component>
<component name="TemplatesService"> <component name="TemplatesService">
<option name="TEMPLATE_CONFIGURATION" value="Django" /> <option name="TEMPLATE_CONFIGURATION" value="Django" />
@ -31,4 +44,4 @@
<option name="projectConfiguration" value="py.test" /> <option name="projectConfiguration" value="py.test" />
<option name="PROJECT_TEST_RUNNER" value="py.test" /> <option name="PROJECT_TEST_RUNNER" value="py.test" />
</component> </component>
</module> </module>

View File

@ -1,144 +0,0 @@
module.exports = function (grunt) {
var appConfig = grunt.file.readJSON('package.json');
// Load grunt tasks automatically
// see: https://github.com/sindresorhus/load-grunt-tasks
require('load-grunt-tasks')(grunt);
// Time how long tasks take. Can help when optimizing build times
// see: https://npmjs.org/package/time-grunt
require('time-grunt')(grunt);
var pathsConfig = function (appName) {
this.app = appName || appConfig.name;
return {
app: this.app,
templates: this.app + '/templates',
css: this.app + '/static/css',
sass: this.app + '/static/sass',
fonts: this.app + '/static/fonts',
images: this.app + '/static/images',
js: this.app + '/static/js',
manageScript: 'manage.py',
}
};
grunt.initConfig({
paths: pathsConfig(),
pkg: appConfig,
// see: https://github.com/gruntjs/grunt-contrib-watch
watch: {
gruntfile: {
files: ['Gruntfile.js']
},
sass: {
files: ['<%= paths.sass %>/**/*.{scss,sass}'],
tasks: ['sass:dev'],
options: {
atBegin: true
}
},
livereload: {
files: [
'<%= paths.js %>/**/*.js',
'<%= paths.sass %>/**/*.{scss,sass}',
'<%= paths.app %>/**/*.html'
],
options: {
spawn: false,
livereload: true,
},
},
},
// see: https://github.com/sindresorhus/grunt-sass
sass: {
dev: {
options: {
outputStyle: 'nested',
{% if cookiecutter.custom_bootstrap_compilation == 'y' %}
includePaths: ['node_modules/bootstrap/scss'],
{% endif %}
sourceMap: false,
precision: 10
},
files: {
'<%= paths.css %>/project.css': '<%= paths.sass %>/project.scss'
},
},
dist: {
options: {
outputStyle: 'compressed',
{% if cookiecutter.custom_bootstrap_compilation == 'y' %}
includePaths: ['node_modules/bootstrap/scss'],
{% endif %}
sourceMap: false,
precision: 10
},
files: {
'<%= paths.css %>/project.css': '<%= paths.sass %>/project.scss'
},
}
},
//see https://github.com/nDmitry/grunt-postcss
postcss: {
options: {
map: true, // inline sourcemaps
processors: [
require('pixrem')(), // add fallbacks for rem units
require('autoprefixer')({browsers: [
'Android 2.3',
'Android >= 4',
'Chrome >= 20',
'Firefox >= 24',
'Explorer >= 8',
'iOS >= 6',
'Opera >= 12',
'Safari >= 6'
]}), // add vendor prefixes
require('cssnano')() // minify the result
]
},
dist: {
src: '<%= paths.css %>/*.css'
}
},
// see: https://npmjs.org/package/grunt-bg-shell
bgShell: {
_defaults: {
bg: true
},
runDjango: {
cmd: 'python <%= paths.manageScript %> runserver'
},
{% if cookiecutter.use_mailhog == "y" and cookiecutter.use_docker == 'n' -%}runMailHog: {
cmd: './mailhog'
},{%- endif %}
}
});
grunt.registerTask('serve', [
{% if cookiecutter.use_mailhog == "y" and cookiecutter.use_docker == 'n' -%}
'bgShell:runMailHog',
{%- endif %}
'bgShell:runDjango',
'watch'
]);
grunt.registerTask('build', [
'sass:dist',
'postcss'
]);
grunt.registerTask('default', [
'build'
]);
};

View File

@ -1,4 +1,3 @@
release: manage.py migrate
web: gunicorn config.wsgi:application web: gunicorn config.wsgi:application
{% if cookiecutter.use_celery == "y" -%} {% if cookiecutter.use_celery == "y" -%}
worker: celery worker --app={{cookiecutter.project_slug}}.taskapp --loglevel=info worker: celery worker --app={{cookiecutter.project_slug}}.taskapp --loglevel=info

View File

@ -19,22 +19,22 @@ RUN apk update \
COPY ./requirements /requirements COPY ./requirements /requirements
RUN pip install -r /requirements/local.txt RUN pip install -r /requirements/local.txt
COPY ./compose/production/django/entrypoint.sh /entrypoint.sh COPY ./compose/production/django/entrypoint /entrypoint
RUN sed -i 's/\r//' /entrypoint.sh RUN sed -i 's/\r//' /entrypoint
RUN chmod +x /entrypoint.sh RUN chmod +x /entrypoint
COPY ./compose/local/django/start.sh /start.sh COPY ./compose/local/django/start /start
RUN sed -i 's/\r//' /start.sh RUN sed -i 's/\r//' /start
RUN chmod +x /start.sh RUN chmod +x /start
{% if cookiecutter.use_celery == "y" %} {% if cookiecutter.use_celery == "y" %}
COPY ./compose/local/django/celery/worker/start.sh /start-celeryworker.sh COPY ./compose/local/django/celery/worker/start /start-celeryworker
RUN sed -i 's/\r//' /start-celeryworker.sh RUN sed -i 's/\r//' /start-celeryworker
RUN chmod +x /start-celeryworker.sh RUN chmod +x /start-celeryworker
COPY ./compose/local/django/celery/beat/start.sh /start-celerybeat.sh COPY ./compose/local/django/celery/beat/start /start-celerybeat
RUN sed -i 's/\r//' /start-celerybeat.sh RUN sed -i 's/\r//' /start-celerybeat
RUN chmod +x /start-celerybeat.sh RUN chmod +x /start-celerybeat
{% endif %} {% endif %}
WORKDIR /app WORKDIR /app
ENTRYPOINT ["/entrypoint.sh"] ENTRYPOINT ["/entrypoint"]

View File

@ -1,3 +1,3 @@
FROM abiosoft/caddy:0.10.6 FROM abiosoft/caddy:0.11.0
COPY ./compose/production/caddy/Caddyfile /etc/Caddyfile COPY ./compose/production/caddy/Caddyfile /etc/Caddyfile

View File

@ -19,23 +19,23 @@ COPY ./requirements /requirements
RUN pip install --no-cache-dir -r /requirements/production.txt \ RUN pip install --no-cache-dir -r /requirements/production.txt \
&& rm -rf /requirements && rm -rf /requirements
COPY ./compose/production/django/gunicorn.sh /gunicorn.sh COPY ./compose/production/django/entrypoint /entrypoint
RUN sed -i 's/\r//' /gunicorn.sh RUN sed -i 's/\r//' /entrypoint
RUN chmod +x /gunicorn.sh RUN chmod +x /entrypoint
RUN chown django /gunicorn.sh RUN chown django /entrypoint
COPY ./compose/production/django/entrypoint.sh /entrypoint.sh COPY ./compose/production/django/start /start
RUN sed -i 's/\r//' /entrypoint.sh RUN sed -i 's/\r//' /start
RUN chmod +x /entrypoint.sh RUN chmod +x /start
RUN chown django /entrypoint.sh RUN chown django /start
{% if cookiecutter.use_celery == "y" %} {% if cookiecutter.use_celery == "y" %}
COPY ./compose/production/django/celery/worker/start.sh /start-celeryworker.sh COPY ./compose/production/django/celery/worker/start /start-celeryworker
RUN sed -i 's/\r//' /start-celeryworker.sh RUN sed -i 's/\r//' /start-celeryworker
RUN chmod +x /start-celeryworker.sh RUN chmod +x /start-celeryworker
COPY ./compose/production/django/celery/beat/start.sh /start-celerybeat.sh COPY ./compose/production/django/celery/beat/start /start-celerybeat
RUN sed -i 's/\r//' /start-celerybeat.sh RUN sed -i 's/\r//' /start-celerybeat
RUN chmod +x /start-celerybeat.sh RUN chmod +x /start-celerybeat
{% endif %} {% endif %}
COPY . /app COPY . /app
@ -45,4 +45,4 @@ USER django
WORKDIR /app WORKDIR /app
ENTRYPOINT ["/entrypoint.sh"] ENTRYPOINT ["/entrypoint"]

View File

@ -5,8 +5,6 @@ set -o pipefail
set -o nounset set -o nounset
cmd="$@"
# N.B. If only .env files supported variable expansion... # N.B. If only .env files supported variable expansion...
export CELERY_BROKER_URL="${REDIS_URL}" export CELERY_BROKER_URL="${REDIS_URL}"
@ -36,12 +34,10 @@ sys.exit(0)
END END
} }
until postgres_ready; do until postgres_ready; do
>&2 echo 'PostgreSQL is unavailable (sleeping)...' >&2 echo 'Waiting for PostgreSQL to become available...'
sleep 1 sleep 1
done done
>&2 echo 'PostgreSQL is available'
>&2 echo 'PostgreSQL is up - continuing...' exec "$@"
exec $cmd

View File

@ -6,4 +6,4 @@ set -o nounset
python /app/manage.py collectstatic --noinput python /app/manage.py collectstatic --noinput
/usr/local/bin/gunicorn config.wsgi -b 0.0.0.0:5000 --chdir=/app /usr/local/bin/gunicorn config.wsgi --bind 0.0.0.0:5000 --chdir=/app

View File

@ -216,8 +216,8 @@ EMAIL_BACKEND = env('DJANGO_EMAIL_BACKEND', default='django.core.mail.backends.s
# ADMIN # ADMIN
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# Django Admin URL regex. # Django Admin URL.
ADMIN_URL = r'^admin/' ADMIN_URL = 'admin/'
# https://docs.djangoproject.com/en/dev/ref/settings/#admins # https://docs.djangoproject.com/en/dev/ref/settings/#admins
ADMINS = [ ADMINS = [
("""{{cookiecutter.author_name}}""", '{{cookiecutter.email}}'), ("""{{cookiecutter.author_name}}""", '{{cookiecutter.email}}'),

View File

@ -4,7 +4,7 @@ from .base import env
# GENERAL # GENERAL
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# https://docs.djangoproject.com/en/dev/ref/settings/#debug # https://docs.djangoproject.com/en/dev/ref/settings/#debug
DEBUG = env.bool('DJANGO_DEBUG', default=True) DEBUG = True
# https://docs.djangoproject.com/en/dev/ref/settings/#secret-key # https://docs.djangoproject.com/en/dev/ref/settings/#secret-key
SECRET_KEY = env('DJANGO_SECRET_KEY', default='!!!SET DJANGO_SECRET_KEY!!!') SECRET_KEY = env('DJANGO_SECRET_KEY', default='!!!SET DJANGO_SECRET_KEY!!!')
# https://docs.djangoproject.com/en/dev/ref/settings/#allowed-hosts # https://docs.djangoproject.com/en/dev/ref/settings/#allowed-hosts

View File

@ -89,7 +89,7 @@ AWS_S3_OBJECT_PARAMETERS = {
STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage' STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'
{%- else %} {%- else %}
STATICFILES_STORAGE = 'config.settings.production.StaticRootS3BotoStorage' STATICFILES_STORAGE = 'config.settings.production.StaticRootS3BotoStorage'
STATIC_URL = 'https://s3.amazonaws.com/%s/static/' % AWS_STORAGE_BUCKET_NAME STATIC_URL = f'https://s3.amazonaws.com/{AWS_STORAGE_BUCKET_NAME}/static/'
{%- endif %} {%- endif %}
# MEDIA # MEDIA
@ -99,7 +99,7 @@ DEFAULT_FILE_STORAGE = 'storages.backends.s3boto3.S3Boto3Storage'
MEDIA_URL = f'https://s3.amazonaws.com/{AWS_STORAGE_BUCKET_NAME}/' MEDIA_URL = f'https://s3.amazonaws.com/{AWS_STORAGE_BUCKET_NAME}/'
{%- else %} {%- else %}
# region http://stackoverflow.com/questions/10390244/ # region http://stackoverflow.com/questions/10390244/
from storages.backends.s3boto3 import S3Boto3Storage from storages.backends.s3boto3 import S3Boto3Storage # noqa E402
StaticRootS3BotoStorage = lambda: S3Boto3Storage(location='static') # noqa StaticRootS3BotoStorage = lambda: S3Boto3Storage(location='static') # noqa
MediaRootS3BotoStorage = lambda: S3Boto3Storage(location='media', file_overwrite=False) # noqa MediaRootS3BotoStorage = lambda: S3Boto3Storage(location='media', file_overwrite=False) # noqa
# endregion # endregion
@ -158,8 +158,8 @@ INSTALLED_APPS += ['gunicorn'] # noqa F405
# http://whitenoise.evans.io/en/latest/django.html#enable-whitenoise # http://whitenoise.evans.io/en/latest/django.html#enable-whitenoise
MIDDLEWARE = ['whitenoise.middleware.WhiteNoiseMiddleware'] + MIDDLEWARE # noqa F405 MIDDLEWARE = ['whitenoise.middleware.WhiteNoiseMiddleware'] + MIDDLEWARE # noqa F405
{%- endif %} {% endif %}
{% if cookiecutter.use_compressor == 'y' -%} {%- if cookiecutter.use_compressor == 'y' -%}
# django-compressor # django-compressor
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# https://django-compressor.readthedocs.io/en/latest/settings/#django.conf.settings.COMPRESS_ENABLED # https://django-compressor.readthedocs.io/en/latest/settings/#django.conf.settings.COMPRESS_ENABLED
@ -169,16 +169,16 @@ COMPRESS_STORAGE = 'storages.backends.s3boto3.S3Boto3Storage'
# https://django-compressor.readthedocs.io/en/latest/settings/#django.conf.settings.COMPRESS_URL # https://django-compressor.readthedocs.io/en/latest/settings/#django.conf.settings.COMPRESS_URL
COMPRESS_URL = STATIC_URL COMPRESS_URL = STATIC_URL
{%- endif %} {% endif %}
{% if cookiecutter.use_whitenoise == 'n' -%} {%- if cookiecutter.use_whitenoise == 'n' -%}
# Collectfast # Collectfast
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# https://github.com/antonagestam/collectfast#installation # https://github.com/antonagestam/collectfast#installation
INSTALLED_APPS = ['collectfast'] + INSTALLED_APPS # noqa F405 INSTALLED_APPS = ['collectfast'] + INSTALLED_APPS # noqa F405
AWS_PRELOAD_METADATA = True AWS_PRELOAD_METADATA = True
{%- endif %} {% endif %}
{% if cookiecutter.use_sentry == 'y' -%} {%- if cookiecutter.use_sentry == 'y' -%}
# raven # raven
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# https://docs.sentry.io/clients/python/integrations/django/ # https://docs.sentry.io/clients/python/integrations/django/
@ -241,6 +241,7 @@ SENTRY_CELERY_LOGLEVEL = env.int('DJANGO_SENTRY_LOG_LEVEL', logging.INFO)
RAVEN_CONFIG = { RAVEN_CONFIG = {
'dsn': SENTRY_DSN 'dsn': SENTRY_DSN
} }
{%- else %} {%- else %}
# LOGGING # LOGGING
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
@ -290,6 +291,6 @@ LOGGING = {
} }
} }
{%- endif %} {% endif %}
# Your stuff... # Your stuff...
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------

View File

@ -1,25 +1,25 @@
from django.conf import settings from django.conf import settings
from django.conf.urls import include, url from django.urls import include, path
from django.conf.urls.static import static from django.conf.urls.static import static
from django.contrib import admin from django.contrib import admin
from django.views.generic import TemplateView from django.views.generic import TemplateView
from django.views import defaults as default_views from django.views import defaults as default_views
urlpatterns = [ urlpatterns = [
url(r"^$", TemplateView.as_view(template_name="pages/home.html"), name="home"), path("", TemplateView.as_view(template_name="pages/home.html"), name="home"),
url( path(
r"^about/$", "about/",
TemplateView.as_view(template_name="pages/about.html"), TemplateView.as_view(template_name="pages/about.html"),
name="about", name="about",
), ),
# Django Admin, use {% raw %}{% url 'admin:index' %}{% endraw %} # Django Admin, use {% raw %}{% url 'admin:index' %}{% endraw %}
url(settings.ADMIN_URL, admin.site.urls), path(settings.ADMIN_URL, admin.site.urls),
# User management # User management
url( path(
r"^users/", "users/",
include("{{ cookiecutter.project_slug }}.users.urls", namespace="users"), include("{{ cookiecutter.project_slug }}.users.urls", namespace="users"),
), ),
url(r"^accounts/", include("allauth.urls")), path("accounts/", include("allauth.urls")),
# Your stuff: custom urls includes go here # Your stuff: custom urls includes go here
] + static( ] + static(
settings.MEDIA_URL, document_root=settings.MEDIA_ROOT settings.MEDIA_URL, document_root=settings.MEDIA_ROOT
@ -29,24 +29,24 @@ if settings.DEBUG:
# This allows the error pages to be debugged during development, just visit # This allows the error pages to be debugged during development, just visit
# these url in browser to see how these error pages look like. # these url in browser to see how these error pages look like.
urlpatterns += [ urlpatterns += [
url( path(
r"^400/$", "400/",
default_views.bad_request, default_views.bad_request,
kwargs={"exception": Exception("Bad Request!")}, kwargs={"exception": Exception("Bad Request!")},
), ),
url( path(
r"^403/$", "403/",
default_views.permission_denied, default_views.permission_denied,
kwargs={"exception": Exception("Permission Denied")}, kwargs={"exception": Exception("Permission Denied")},
), ),
url( path(
r"^404/$", "404/",
default_views.page_not_found, default_views.page_not_found,
kwargs={"exception": Exception("Page not Found")}, kwargs={"exception": Exception("Page not Found")},
), ),
url(r"^500/$", default_views.server_error), path("500/", default_views.server_error),
] ]
if "debug_toolbar" in settings.INSTALLED_APPS: if "debug_toolbar" in settings.INSTALLED_APPS:
import debug_toolbar import debug_toolbar
urlpatterns = [url(r"^__debug__/", include(debug_toolbar.urls))] + urlpatterns urlpatterns = [path("__debug__/", include(debug_toolbar.urls))] + urlpatterns

View File

@ -23,12 +23,10 @@ from django.core.wsgi import get_wsgi_application
app_path = os.path.abspath(os.path.join( app_path = os.path.abspath(os.path.join(
os.path.dirname(os.path.abspath(__file__)), os.pardir)) os.path.dirname(os.path.abspath(__file__)), os.pardir))
sys.path.append(os.path.join(app_path, '{{ cookiecutter.project_slug }}')) sys.path.append(os.path.join(app_path, '{{ cookiecutter.project_slug }}'))
{% if cookiecutter.use_sentry == 'y' -%} {% if cookiecutter.use_sentry == 'y' -%}
if os.environ.get('DJANGO_SETTINGS_MODULE') == 'config.settings.production': if os.environ.get('DJANGO_SETTINGS_MODULE') == 'config.settings.production':
from raven.contrib.django.raven_compat.middleware.wsgi import Sentry from raven.contrib.django.raven_compat.middleware.wsgi import Sentry
{%- endif %} {%- endif %}
# We defer to a DJANGO_SETTINGS_MODULE already in the environment. This breaks # We defer to a DJANGO_SETTINGS_MODULE already in the environment. This breaks
# if running multiple sites in the same mod_wsgi process. To fix this, use # if running multiple sites in the same mod_wsgi process. To fix this, use
# mod_wsgi daemon mode with each site in its own daemon process, or use # mod_wsgi daemon mode with each site in its own daemon process, or use

View File

@ -22,7 +22,7 @@ services:
- ./.envs/.local/.postgres - ./.envs/.local/.postgres
ports: ports:
- "8000:8000" - "8000:8000"
command: /start.sh command: /start
postgres: postgres:
build: build:
@ -60,7 +60,7 @@ services:
- ./.envs/.local/.django - ./.envs/.local/.django
- ./.envs/.local/.postgres - ./.envs/.local/.postgres
ports: [] ports: []
command: /start-celeryworker.sh command: /start-celeryworker
celerybeat: celerybeat:
<<: *django <<: *django
@ -75,6 +75,6 @@ services:
- ./.envs/.local/.django - ./.envs/.local/.django
- ./.envs/.local/.postgres - ./.envs/.local/.postgres
ports: [] ports: []
command: /start-celerybeat.sh command: /start-celerybeat
{%- endif %} {%- endif %}

View File

@ -3,28 +3,7 @@
"version": "{{ cookiecutter.version }}", "version": "{{ cookiecutter.version }}",
"dependencies": {}, "dependencies": {},
"devDependencies": { "devDependencies": {
{% if cookiecutter.js_task_runner == 'Grunt' %} {% if cookiecutter.js_task_runner == 'Gulp' %}
"autoprefixer": "~8.1.0",
{% if cookiecutter.custom_bootstrap_compilation == 'y' %}
"bootstrap": "^4.0.0",
{% endif %}
"connect-livereload": "~0.6.0",
"cssnano": "~3.10.0",
"grunt": "~1.0.2",
"grunt-bg-shell": "~2.3.1",
"grunt-contrib-watch": "~1.0.0",
"grunt-postcss": "~0.9.0",
"grunt-sass": "~2.1.0",
{% if cookiecutter.custom_bootstrap_compilation == 'y' %}
"jquery": "^3.2.1-slim",
{% endif %}
"load-grunt-tasks": "~3.2.0",
"pixrem": "~4.0.1",
{% if cookiecutter.custom_bootstrap_compilation == 'y' %}
"popper.js": "^1.12.3",
{% endif %}
"time-grunt": "~1.2.1"
{% elif cookiecutter.js_task_runner == 'Gulp' %}
{% if cookiecutter.custom_bootstrap_compilation == 'y' %} {% if cookiecutter.custom_bootstrap_compilation == 'y' %}
"bootstrap": "^4.0.0", "bootstrap": "^4.0.0",
{% endif %} {% endif %}
@ -54,11 +33,8 @@
"node": ">=0.8.0" "node": ">=0.8.0"
}, },
"scripts": { "scripts": {
{% if cookiecutter.js_task_runner == 'Grunt' %} {% if cookiecutter.js_task_runner == 'Gulp' %}
"dev": "grunt serve"
{% elif cookiecutter.js_task_runner == 'Gulp' %}
"dev": "gulp" "dev": "gulp"
{% endif %} {% endif %}
} }
} }

View File

@ -17,7 +17,7 @@ services:
env_file: env_file:
- ./.envs/.production/.django - ./.envs/.production/.django
- ./.envs/.production/.postgres - ./.envs/.production/.postgres
command: /gunicorn.sh command: /start
postgres: postgres:
build: build:
@ -58,7 +58,7 @@ services:
env_file: env_file:
- ./.envs/.production/.django - ./.envs/.production/.django
- ./.envs/.production/.postgres - ./.envs/.production/.postgres
command: /start-celeryworker.sh command: /start-celeryworker
celerybeat: celerybeat:
<<: *django <<: *django
@ -69,6 +69,6 @@ services:
env_file: env_file:
- ./.envs/.production/.django - ./.envs/.production/.django
- ./.envs/.production/.postgres - ./.envs/.production/.postgres
command: /start-celerybeat.sh command: /start-celerybeat
{%- endif %} {%- endif %}

View File

@ -1,5 +1,5 @@
pytz==2018.4 # https://github.com/stub42/pytz pytz==2018.4 # https://github.com/stub42/pytz
awesome-slugify==1.6.5 # https://github.com/dimka665/awesome-slugify python-slugify==1.2.5 # https://github.com/un33k/python-slugify
Pillow==5.1.0 # https://github.com/python-pillow/Pillow Pillow==5.1.0 # https://github.com/python-pillow/Pillow
{%- if cookiecutter.use_compressor == "y" %} {%- if cookiecutter.use_compressor == "y" %}
rcssmin==1.0.6{% if cookiecutter.windows == 'y' %} --install-option="--without-c-extensions"{% endif %} # https://github.com/ndparker/rcssmin rcssmin==1.0.6{% if cookiecutter.windows == 'y' %} --install-option="--without-c-extensions"{% endif %} # https://github.com/ndparker/rcssmin

View File

@ -1,14 +1,14 @@
from django.conf.urls import url from django.urls import path
from . import views from . import views
app_name = "users" app_name = "users"
urlpatterns = [ urlpatterns = [
url(regex=r"^$", view=views.UserListView.as_view(), name="list"), path("", view=views.UserListView.as_view(), name="list"),
url(regex=r"^~redirect/$", view=views.UserRedirectView.as_view(), name="redirect"), path("~redirect/", view=views.UserRedirectView.as_view(), name="redirect"),
url(regex=r"^~update/$", view=views.UserUpdateView.as_view(), name="update"), path("~update/", view=views.UserUpdateView.as_view(), name="update"),
url( path(
regex=r"^(?P<username>[\w.@+-]+)/$", "<str:username>",
view=views.UserDetailView.as_view(), view=views.UserDetailView.as_view(),
name="detail", name="detail",
), ),