Django: Unterschied zwischen den Versionen
Zur Navigation springen
Zur Suche springen
(→REST) |
(→REST) |
||
Zeile 73: | Zeile 73: | ||
==REST== | ==REST== | ||
* [http://django-rest-framework.org/ Django REST Framework] | * [http://django-rest-framework.org/ Django REST Framework] | ||
+ | |||
+ | ==AngularJS== | ||
+ | * [https://www.youtube.com/watch?v=Q8FRBGTJ020 django-rest-framework and angularjs] | ||
==Hosting== | ==Hosting== |
Version vom 7. August 2013, 12:49 Uhr
Django - a high-level Python Web framework that encourages rapid development and clean, pragmatic design.
Aptana Configuration
- Win-Preferences->PyDev->Editor->Code Completeion: Apply completion on '.' and '('
Install Packages
- Find version: https://pypi.python.org/pypi/
Virtualenv
Activate:
- source <your_environment>/bin/activate
- . ~/.environments/<your_environment>/bin/activate
Tutorials
Style Guides
Images
- http://www.sandersnewmedia.com/why/2012/04/16/installing-pil-virtualenv-ubuntu-1204-precise-pangolin/ - fix image showing problem.
Configure with PyCharm
Databases
- Install Databases
~/.environments/<PROJEKT>env/bin/pip install -r requirements.txt
Requirements.txt
On change of the requirements.txt:
- pip install -r requirements.txt
- <ENV> manage.py syncdb
- <ENV> manage.py migrate
Migrations
- Migrate on change of requirements.txt, e.g. new tables are added.
- <ENV> manage.py syncdb
- <ENV> manage.py migrate
- Migrate on model change:
- manage.py schemamigration app_name --auto
- manage.py migrate app_name
- Django database migration tool: south, explained
- Delete migration
- manage.py migrate <app_name> <number_of_migration_to_rollback_to>
- delete file
Internationalization
- How Django discovers translations
- Create or update message files:
- manage.py makemessages -l de
- Compile:
- manage.py compilemessages -v 2 -l de
- Compile all:
- bash compilemessages.sh
If you have problems with translating strings:
- read How Django discovers translation https://docs.djangoproject.com/en/1.5/topics/i18n/translation/#how-django-discovers-translations
- Define in your settings.py to make sure that strings are first read from the directory defined by you:
- BASEPATH = realpath(join(dirname(_file), '..'))
- LOCALE_PATHS = (
- join(BASE_PATH, 'locale'),
- )
- Stackoverflow: http://stackoverflow.com/questions/1832709/django-how-to-make-translation-work?rq=1