[BangPypers] Django using syncdb does not work

Senthil skksundar at yahoo.co.in
Tue Jun 3 05:40:20 CEST 2014


Thanks for the prompt response. 

Sorry that I mentioned syncdb to create models from database instead of inspectdb;
But in practice, i used inspectdb only and i am facing error condition. 

In  short time, let me share the error.

Thanks again.

On Tuesday, 3 June 2014 9:02 AM, Gora Mohanty <gora at mimirtech.com> wrote:

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
to go.

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 mailing list