Difference between revisions of "Django"
Jump to navigation
Jump to search
Rafahsolis (talk | contribs) |
Rafahsolis (talk | contribs) |
||
| Line 21: | Line 21: | ||
To create the database tables execute from the project folder: | To create the database tables execute from the project folder: | ||
<nowiki>python manage.py migrate</nowiki> | <nowiki>python manage.py migrate</nowiki> | ||
| + | ==== Run App in development server ==== | ||
| + | If the server is an amazon aws: | ||
| + | <nowiki>python manage.py runserver 0.0.0.0:8000 </nowiki> | ||
| + | Else: | ||
| + | <nowiki>python manage.py runserver</nowiki> | ||
Revision as of 23:39, 15 March 2015
Requirements:
- Python
- Database (MySQL / PostgreSQL...)
Installation:
pip install django
Create project
django-admin.py startproject mysite
Database Setup
Edit: mysite/settings.py
In DATABASES = {...
- ENGINE – Either 'django.db.backends.sqlite3', 'django.db.backends.postgresql_psycopg2', 'django.db.backends.mysql', or 'django.db.backends.oracle'.
- NAME – The name of your database.
- USER – Username for the database.
- PASSWORD – Password for the database.
- HOST – Database HOST.
To create the database tables execute from the project folder:
python manage.py migrate
Run App in development server
If the server is an amazon aws:
python manage.py runserver 0.0.0.0:8000
Else:
python manage.py runserver