aboutsummaryrefslogtreecommitdiff
path: root/cheat/.cheat/django
diff options
context:
space:
mode:
authorneodarz <neodarz@neodarz.net>2019-04-26 11:34:19 +0200
committerneodarz <neodarz@neodarz.net>2019-04-26 11:34:19 +0200
commit469e62e70891a37ec4016fcd025f979859074ef7 (patch)
tree690faf01abd10b7d6721d4e46b5dcbfd0727efb3 /cheat/.cheat/django
parent537e727f43311bc30d93c9af645dde3450605129 (diff)
downloaddotfiles_ascii-469e62e70891a37ec4016fcd025f979859074ef7.tar.xz
dotfiles_ascii-469e62e70891a37ec4016fcd025f979859074ef7.zip
Add moooore cheat
Diffstat (limited to '')
-rw-r--r--cheat/.cheat/django19
-rw-r--r--cheat/.cheat/djangocms29
2 files changed, 48 insertions, 0 deletions
diff --git a/cheat/.cheat/django b/cheat/.cheat/django
index ebb5817..97efafc 100644
--- a/cheat/.cheat/django
+++ b/cheat/.cheat/django
@@ -29,3 +29,22 @@ django-admin makemessages -l fr
# compil translations files
django-admin compilemessages
+
+# Pour tester avec debug=False et manage.py runserver
+source : https://stackoverflow.com/a/49722734
+
+In urls.py I added this line:
+
+```
+from django.views.static import serve
+```
+
+add those two urls in urlpatterns:
+
+```
+url(r'^media/(?P<path>.*)$', serve,{'document_root': settings.MEDIA_ROOT}),
+url(r'^static/(?P<path>.*)$', serve,{'document_root': settings.STATIC_ROOT}),
+```
+
+and both static and media files were accesible when DEBUG=FALSE.
+Hope it helps :)
diff --git a/cheat/.cheat/djangocms b/cheat/.cheat/djangocms
new file mode 100644
index 0000000..76c0826
--- /dev/null
+++ b/cheat/.cheat/djangocms
@@ -0,0 +1,29 @@
+# Apphook theme integration
+
+This is maybe not the best way to do this but it's work.
+
+First doc is here : http://docs.django-cms.org/en/latest/introduction/05-apphooks.html
+
+(`.` is the root of the django-cms project)
+(`myApp` is the django app to be ingreted to django-cms)
+
+Create another django app specialy for integrate the wanted django app.
+(ex: `./myApp_cms_integration/`)
+
+For apply the theme you need, in the cms app create a folder, to create a
+`templates` folder for the integrated django app.
+(ex: `./myApp_cms_integration/templates/myApp/`)
+
+Copy the base.html template of myApp django app and modify the file with this
+code:
+
+```
+{% extends "base.html" %}
+
+{% block apps %}
+# Here come all the code from the base.html of myApp (In this example)
+{% endblock %}
+```
+
+You also need to add somewhere in the template of the django-cms project
+`{% block apps %}{% endblock %}`.