Showing posts with label heroku. Show all posts
Showing posts with label heroku. Show all posts

Monday, January 12, 2015

PHP application with Mysql database to a Django app with Postgres Database

Recently I had a chance to work on a project, where a PHP app had to be converted to a Django one.

The work seemed trivial, but it brought a few difficult technicalities. It had a Mysql DB, with few tables. Overall, I had to  -


  • Convert them into Django models
  • Convert the app into Django
  • Setup the app on Heroku using Postgres

  1. Converting the models to Django is easy. Django provides an inspectdb command. It looks at the current model structures, inspects it and provides django model accordingly.
  2. This is a nice feature. It gave me a push forward to begin the app development. However, this feature lacked some points that I would like to point out - 
    1. In Mysql, we have a set type . This is basically similar to choices in Django models. I had to manually do that. 
    2. The foreign key constraint is set to id by default. The command could check this and set the field in model declaration using to_field parameter.
    3. The DB views had to created manually. 
  3. For changing Mysql Data to Heroku, https://devcenter.heroku.com/articles/heroku-mysql is a good resource.
As always, heroku has to be provided with a S3 access to uploading of static and media files. But thats a different matter.

Sunday, July 14, 2013

Experiment with Heroku, Google Charts, and Django

So, one of the experiments that I just did was quickly making a Django app, deploying it on heroku.

I have uploaded it to Github as well. Here is the link.

The problems that I faced were -

1) the static files handling in heroku -  foreman doesnt work like runserver, and has to be configured as the help says. But in my case, I didnt want to re configure just to serve a small app, so my app is currently serving 3 static files.
2) The structure of the app is such that the root folder had name different than that of the app, registered at heroku. This caused the error no Cedar supported app detected.


These were the two small problems that I faced. reference solutions can be seen in github link.