[BangPypers] Django using syncdb does not work
gora at mimirtech.com
Tue Jun 3 05:32:35 CEST 2014
On 3 June 2014 08:48, Senthil <skksundar at yahoo.co.in> wrote:
> Hi All,
> I am in process of writing an application.
> While designing models, I have the database tables created first and tried using syncdb to create the models.
> When i try to access the models from view I get error.
> Upon searching in google, I found that only after designing models, the database is being created.
Please try out the nice Django tutorial on the site. Learning how to
use syncdb is a very basic
step, and you need to be completely familiar with this process.
> Should I follow the second approach?
> Or is there a way i can create tables and sync them to create models and make them work successfully?
Normally, with a framework like Django. one designs the system
top-down; from user needs to
models which the Django ORM translates to database tables for you. So,
yes, that is the way
An exception is if one already has a database with tables, say from
another site, or from
Wordpress, Drupal, etc. In that case, one can use Django's inspectdb
to create the initial
models by examining the existing tables, i.e., the reverse of the
normal process. While
such auto-generated models are crude, they are fine as a base to start from.
More information about the BangPypers