Recreating database after modifying django models

Sometimes I needed to change my django models, and it might create error that certain column cannot be found. If you have not much data yet, the simplest is to recreate the database. This is the step:

Go to mysql client:

<pre>$ mysql -u root -p mysql</pre>

Show the databse

<pre>mysql> show databases;</pre>

Drop the database

<pre>mysql>drop database databasename;</pre>

Create database

<pre>mysql>create database databasename;</pre>

Fixing Django admin style

I was trying out django tutorial. It works fine when I use the webserver provided by django. But when I tried to deploy on an Apache server. The admin page has lost its style. I tried to google around, and show suggestion to set Apache Alias for media to redirect to the media folder for django. But I couldn’t find media folder for django. It turns out that from django 1.4 onwards we should refer to static folder instead. So this is the modification that I made:

On /etc/apache2/apache2.conf:

<pre>

Alias /static/admin /home/ubuntu/websenv/lib/python2.7/site-packages/django/contrib/admin/static/admin/

</pre>

to point to the location of the static files for admin page. And that solves my problem.