If there are any errors while generating a response to a request in the view or template, there needs to be a way to roll back any changes to the database so as to avoid corruption. Luckily, Django includes middleware just for this purpose (creatively named TransactionMiddleware). When enabled, it runs each request/response cycle inside a database transaction. If any errors occur, the transaction is rolled back, and if the response is returned without any problems, the transaction is completed. Unfortunately, since we are using MySQL and since the default database engine for MySQL is MyISAM which doesn't support transactions, we must change all of our tables to InnoDB which does support transactions. This required a new setting DATABASE_OPTIONS, which has now been committed. If you already have a MySQL database locally, you need only to drop the old database and run syncdb + migrate like you normally would. While running syncdb, however, when you are asked if you would like to create a superuser say no. This is because the table for UserProfiles has not been created yet and will cause an error when syncdb tries to create a User. This should be noted in the bug for setting up the staging/production server. If you are not using MySQL as your backend, simply override DATABASE_OPTIONS in your local_settings.py.
Status: NEW → RESOLVED
Last Resolved: 9 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.