Friday, December 14, 2012

DJango Python 101

DJango commands cheatsheet


How to start server:
./manage.py runserver

How to create new app
./manage.py startapp newappname

Database stuff
How to create database from models (Use South instead)
./manage.py syncdb

How to use South
http://south.readthedocs.org/en/latest/commands.html

For existing app
you will need to convert into South supported app first.
./manage.py convert_to_south myappname

For new apps
Create db (Similar to syncdb command)
./manage.py schemamigration myappname --initial

Update db with schema changes
./manage.py schemamigration myappname --auto

These commands generates migration scripts only.
Run this command for changes to take effect in db
./manage.py migrate myappname

3 comments:

  1. Python language course provides complete practical knowledge of Python programming. It explains core syntax and advanced concepts clearly. This python language course improves real-time coding skills. Students work on live coding projects. Data structures and OOP are included. File handling and exception handling are covered. Best practices and libraries are explained. It prepares job-ready Python developers.

    ReplyDelete
  2. Excellent overview! A data modeling course
    helps professionals understand relationships, schemas, and data flow. Practical exposure ensures better implementation in real business environments.

    ReplyDelete