Create models table from exists database?

40 vues
Accéder directement au premier message non lu

Dario Concilio

non lue,
21 avr. 2015, 05:00:1621/04/2015
à django...@googlegroups.com
Hi to all!
I'm new of django, I've a question for you: Can I create a new project using an exists database?

I've a domotic system on Ubuntu Server, with a Postgres database that has several table. Actually the system uses a table by a python service and PHP portal for data management of domotic configuration.

I would change portal admin with a "django" portal, can I create a new django project using this database?
Django framework allows me to generate the system tables and complete models (model.py) from existing ones?

PS: I imagine this approach as the technique called "Database First" of various ORM.

Thanks to all.

David Palao

non lue,
21 avr. 2015, 05:34:1821/04/2015
à django...@googlegroups.com
Hi,
Yes, in principle you can.The keywords are "legacy database":
https://docs.djangoproject.com/en/1.8/howto/legacy-databases/

Best
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users...@googlegroups.com.
> To post to this group, send email to django...@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/e38f24fd-ebce-40ff-b53b-b94c5234d07a%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

felix

non lue,
21 avr. 2015, 08:23:3621/04/2015
à django...@googlegroups.com
El 21/04/15 03:15, Dario Concilio escribió:
Hi to all!
I'm new of django, I've a question for you: Can I create a new project using an exists database?

I've a domotic system on Ubuntu Server, with a Postgres database that has several table. Actually the system uses a table by a python service and PHP portal for data management of domotic configuration.

I would change portal admin with a "django" portal, can I create a new django project using this database?
Django framework allows me to generate the system tables and complete models (model.py) from existing ones?


Check Legacy databases in the official doc. This is what you're looking for:

python manage.py inspectdb

Cheers.

Dario Concilio

non lue,
21 avr. 2015, 09:06:3721/04/2015
à django...@googlegroups.com
Great!
Thank you!
Répondre à tous
Répondre à l'auteur
Transférer
0 nouveau message