Changeset - 37fb435e1894
[Not reviewed]
0 3 1
James Polley - 7 years ago 2017-08-28 07:12:05
jp@jamezpolley.com
Add devmode_settings.py for local dev

* Adds an env variable to .env to turn on dev mode
* Uses the inbuilt django auth rather than saml when in dev mode
* For laziness, re-uses the admin login form for the non-admin login

make_dev_container now comes up ready to be logged into by any
user. No non-admin users are preconfigured; but you can add one at
http://localhost:28000/admin/auth/user/add/, log out, and then hit
http://localhost:28000/ to log in as the new user.
4 files changed with 17 insertions and 1 deletions:
0 comments (0 inline, 0 general)
docker/laptop-mode-env
Show inline comments
...
 
@@ -4,3 +4,4 @@ STRIPE_SECRET_KEY=5CEA51A5-A613-4AEF-A9FB-D0A57D77C13B
 
GCS_BUCKET=5CEA51A5-A613-4AEF-A9FB-D0A57D77C13B
 
GOOGLE_APPLICATION_CREDENTIALS=/dev/null
 
DATABASE_URL=sqlite:////tmp/symposion.sqlite
 
SYMPOSION_DEV_MODE=LAPTOP
...
 
\ No newline at end of file
pinaxcon/devmode_settings.py
Show inline comments
 
new file 100644
 
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
 
AUTHENTICATION_BACKENDS = [
 
    'symposion.teams.backends.TeamPermissionsBackend',
 
    'django.contrib.auth.backends.ModelBackend',
 
]
 
LOGIN_URL='/accounts/login'
 

	
pinaxcon/settings.py
Show inline comments
...
 
@@ -382,3 +382,8 @@ DEFAULT_FILE_STORAGE = 'gapc_storage.storage.GoogleCloudStorage'
 
GAPC_STORAGE = {
 
    'num_retries': 2,
 
}
 

	
 
DEV_MODE = os.environ.get("SYMPOSION_DEV_MODE", None)
 
if DEV_MODE and DEV_MODE == "LAPTOP":
 
    print("ENABLING LAPTOP MODE")
 
    from .devmode_settings import *
pinaxcon/urls.py
Show inline comments
...
 
@@ -33,6 +33,9 @@ urlpatterns = [
 
if settings.DEBUG:
 
    import debug_toolbar
 
    urlpatterns.insert(0, url(r'^__debug__/', include(debug_toolbar.urls)))
 

	
 
if settings.DEV_MODE:
 
    from django.contrib.auth.views import login, logout
 
    urlpatterns.insert(0, url(r'^accounts/logout', logout, {'template_name': 'admin/logout.html'}))
 
    urlpatterns.insert(0, url(r'^accounts/login', login, {'template_name': 'admin/login.html'}))
 

	
 
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
0 comments (0 inline, 0 general)