Django
DB anlegen (mysql):
mysqladmin -u jones -p create guestbook --default-character-set=utf8
Admin freischalten
- Es fehlt ein Eintrag in djange_site:
mysql -u jones -p guestbook insert into django_site (domain, name) values('localhost', 'admin'); commit;
- Admin anlegen:
cd $PROJ python manage.py createsuperuser
Neues Projekt
- Eclipse: File - new - other: Django Project
- Neue Applikation: python manage.py startapp <appl>
- Modell anlegen: z.B. Poll
from django.db import models class Poll(models.Model): question = models.CharField(max_length=200) pub_date = models.DateTimeField('date published')
- Modell prüfen: python manage.py sql polls
- DB anlegen/abgleichen: python manage.py syncdb
- URLs verwalten: <proj>/
Entwicklung
python manage.py runserver
In Eclipse:
- Project: sidu-installer2
- Main Module: ${workspace_loc:sidu-installer2/manage.py}
- Arguments: runserver --noreload