MVC and django fundamentals

后端 未结 3 2024
时光说笑
时光说笑 2021-02-08 23:24

Pretty new to this scene and trying to find some documentation to adopt best practices. We\'re building a fairly large content site which will consist of various media catalogs

3条回答
  •  时光取名叫无心
    2021-02-09 00:05

    To understand django fundementals and the django take on MVC, consult the following: http://www.djangobook.com/

    As a starting point to getting your hands dirty with ... "...trying to find some comparable data / architectural models"

    Here is a quick and dirty way to reverse engineer a database to get a models.py file, which you can then inspect to see how django would handle it.

    1.) get an er diagram that closely matches your target. For example something like this http://www.databaseanswers.org/data_models/product_catalogs/index.htm

    2.) create an sql script from the er diagram and create the database, I suggest Postgre, as some MySQL table type will not have forgien key constraints, but in a pinch MySQL or SQLITE will do

    3.) create and configure a django app to use that database. Then run: python manage.py inspectdb

    This will at least give you a models.py file which you can read to see how django attempts to model it.

    Note that the inspect command is intended to be a shortcut for dealing with legacy database when developing in django, and as such is not perfect. Be sure to read the following before attempting this: http://docs.djangoproject.com/en/dev/ref/django-admin/#ref-django-admin

提交回复
热议问题