Django: Getting Started Transcripts
Chapter: Course conclusion
Lecture: Migration and deployment
Login or
purchase this course
to watch this video and the rest of the course contents.
0:00
The ORM is an abstraction of the database using data models. Each model is a proxy to a row in the database when you need to change
0:08
your model, that means a corresponding change needs to happen in the database. Django includes tools for managing these schema changes
0:16
through a mechanism called a migration script. A migration script is a Python script that indicates what changes need to happen in the
0:23
database and it's used by the migrate command to execute those changes, migrations can happen either forwards or backwards with a few caveats.
0:33
Although this is a powerful tool, it isn't magic. So you need to be careful with how new columns affect existing
0:39
data and how removing columns will delete data permanently. The setting.py file is the heart of configuration for your project.
0:48
Unfortunately, there's only one of these which means your desire to have different settings in dev testing and production requires a bit of extra work.
0:56
When you go into production, your web server will talk to Django through either the WSGI or AWSGI interface and you should configure the server so
1:06
that it is responsible for static and media files. Leaving Django to do dynamic web pages as it was designed for.
1:14
Don't forget that by default, your settings.py file has a secret key in
1:17
it and could have even more sensitive stuff depending on what libraries you're using. Be careful not to include these in a public repo.