Create models table from exists database?

Visto 40 veces
Saltar al primer mensaje no leído

Dario Concilio

no leída,
21 abr 2015, 5:00:1621/4/15
a 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

no leída,
21 abr 2015, 5:34:1821/4/15
a 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

no leída,
21 abr 2015, 8:23:3621/4/15
a 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

no leída,
21 abr 2015, 9:06:3721/4/15
a django...@googlegroups.com
Great!
Thank you!
Responder a todos
Responder al autor
Reenviar
0 mensajes nuevos