diff --git a/docs/deployment-on-heroku.rst b/docs/deployment-on-heroku.rst index 6ee99fee..2190ba82 100644 --- a/docs/deployment-on-heroku.rst +++ b/docs/deployment-on-heroku.rst @@ -16,6 +16,7 @@ You can either push the 'deploy' button in your generated README.rst or run thes heroku addons:create heroku-redis:hobby-dev heroku addons:create mailgun + heroku config:set DJANGO_SECRET_KEY=`openssl rand -base64 32` heroku config:set DJANGO_SECRET_KEY=`openssl rand -base64 32` heroku config:set DJANGO_SETTINGS_MODULE='config.settings.production' heroku config:set DJANGO_ALLOWED_HOSTS='.herokuapp.com' diff --git a/docs/settings.rst b/docs/settings.rst index 0c36df1c..6364ea4b 100644 --- a/docs/settings.rst +++ b/docs/settings.rst @@ -9,6 +9,7 @@ For configuration purposes, the following table maps environment variables to th ======================================= =========================== ============================================== ====================================================================== Environment Variable Django Setting Development Default Production Default ======================================= =========================== ============================================== ====================================================================== +DJANGO_ADMIN_URL n/a r'^admin/' raises error DJANGO_CACHES CACHES (default) locmem redis DJANGO_DATABASES DATABASES (default) See code See code DJANGO_DEBUG DEBUG True False diff --git a/{{cookiecutter.repo_name}}/config/settings/common.py b/{{cookiecutter.repo_name}}/config/settings/common.py index 575bb6fd..19442010 100644 --- a/{{cookiecutter.repo_name}}/config/settings/common.py +++ b/{{cookiecutter.repo_name}}/config/settings/common.py @@ -277,4 +277,8 @@ INSTALLED_APPS += ('kombu.transport.django',) BROKER_URL = env("CELERY_BROKER_URL", default='django://') ########## END CELERY {% endif %} + +# Location of root django.contrib.admin URL, use {% url 'admin:index' %} +ADMIN_URL = r'^admin/' + # Your common stuff: Below this line define 3rd party library settings diff --git a/{{cookiecutter.repo_name}}/config/settings/production.py b/{{cookiecutter.repo_name}}/config/settings/production.py index 7c9fc400..ba9c533e 100644 --- a/{{cookiecutter.repo_name}}/config/settings/production.py +++ b/{{cookiecutter.repo_name}}/config/settings/production.py @@ -217,4 +217,8 @@ RAVEN_CONFIG = { 'DSN': SENTRY_DSN } {% endif %} + +# Custom Admin URL, use {% url 'admin:index' %} +ADMIN_URL = env('ADMIN_URL') + # Your production stuff: Below this line define 3rd party library settings diff --git a/{{cookiecutter.repo_name}}/config/urls.py b/{{cookiecutter.repo_name}}/config/urls.py index 8cf2596d..c2afcc63 100644 --- a/{{cookiecutter.repo_name}}/config/urls.py +++ b/{{cookiecutter.repo_name}}/config/urls.py @@ -12,8 +12,8 @@ urlpatterns = [ url(r'^$', TemplateView.as_view(template_name='pages/home.html'), name="home"), url(r'^about/$', TemplateView.as_view(template_name='pages/about.html'), name="about"), - # Django Admin - url(r'^admin/', include(admin.site.urls)), + # Django Admin, use {% url 'admin:index' %} + url(settings.ADMIN_URL, include(admin.site.urls)), # User management url(r'^users/', include("{{ cookiecutter.repo_name }}.users.urls", namespace="users")), diff --git a/{{cookiecutter.repo_name}}/env.example b/{{cookiecutter.repo_name}}/env.example index 381a3cf0..eb2a1529 100644 --- a/{{cookiecutter.repo_name}}/env.example +++ b/{{cookiecutter.repo_name}}/env.example @@ -1,6 +1,7 @@ POSTGRES_PASSWORD=mysecretpass POSTGRES_USER=postgresuser +ADMIN_URL= DJANGO_SETTINGS_MODULE=config.settings.production DJANGO_SECRET_KEY= DJANGO_ALLOWED_HOSTS= @@ -10,4 +11,4 @@ DJANGO_AWS_STORAGE_BUCKET_NAME= DJANGO_MAILGUN_API_KEY= DJANGO_MAILGUN_SERVER_NAME= DJANGO_SERVER_EMAIL= -DJANGO_SECURE_SSL_REDIRECT=False \ No newline at end of file +DJANGO_SECURE_SSL_REDIRECT=False