aboutsummaryrefslogtreecommitdiff
path: root/cheat/.cheat/django
blob: 97efafcf1106aa14d3de776e1791a2f50cabeafd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# Make a migration
change model in models.py
python manage.py makemigrations
python manage.py migrate

#Django source code
python -c "import django; print(django.__path__)"

# Enable virtual env:
mkvirtualenv --python=/usr/bin/python3 oscar

# Don't forget to install
pip install django

# Run dev server
python manage.py runserver 127.0.0.1:8000

# tinymce for django
https://github.com/romanvm/django-tinymce4-lite

# For create a .po file for translation
# first create a locale folder in module folder or edit LOCALE_PATH in conf file

# run command for generate the file
django-admin makemessages -l fr

# update the file if there are new translation
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 :)