how to implement Northwind in Django

那年仲夏 提交于 2020-01-14 14:29:20

问题


I am trying to implement Northwind database model in MySQL using Django-admin for displaying data. Does someone know how to do it "clean" way from original model? Is there any functional implementation to download (models, admin)?


回答1:


Totally untried procedure follows. Not sure what you mean by 'clean'. Here's a few things on the internet that might help:

Step 1 - export from Access to MySQL:

http://www.geeksengine.com/article/export-access-to-mysql-4.html

Step 2 - point django at the database and use inspectdb to create models.py

https://docs.djangoproject.com/en/dev/ref/django-admin/#inspectdb

Step 3 - clean up models.py, run syncdb, add it to the admin, see what you go.

Step 4 - ask this guy if he ever managed it:

http://ifdebug.com/django-northwind-coming-soon/ - he's had four years!




回答2:


https://github.com/ouykjh/northwind_management/

I managed to create models for Northwind Database.

Just clone the repo. Make sure that settings.py are set.

Enter postgres -> create database named 'mydb' (as in settings.py).

Hit python manage.py syncdb - it will create tables with relations.

Enter postgres -> psql mydb

hit \i inserty.psql

Inserts are here(https://github.com/ouykjh/northwind_management/blob/master/inserty.sql#L11)

Hope it works :)



来源:https://stackoverflow.com/questions/8552256/how-to-implement-northwind-in-django

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!