0

I am building a web interface for a database at my school. The database will hold our school's versions of academic standards.

When you build a site using django, does it create a clean database? For example, wysiwyg website builders like dreamweaver create ugly html and css code on the backend. I would hate to see a similar degree of auto-generated cruft in my database.

Should I create the database myself and then build a django site to access the database, or go ahead and let django create the database?

japhyr
  • 1,710
  • 2
  • 18
  • 24
  • Is your question: does django put html and css into the database? If that is your question, the answer is: no, django does not put HTML and CSS into the database. – Ted May 11 '11 at 22:44
  • I see the confusion. I know it does not put hmtl and css into the database. I meant to ask if there was a similar degree of cruft in the auto-generated database. I will go ahead and give django a try. – japhyr May 12 '11 at 06:30
  • If you give Django a try, make sure you use South, virtualenv and pip. I cannot stress how helpful these three tools are. – Alex Jillard May 12 '11 at 13:32

3 Answers3

1

Under any simple to moderately complex application, Django will do a fine job creating the database for you. I've yet to run into any issues with what it's made.

I would suggest that you use South to handle your table migrations. And use virtualenv and pip to set up and maintain your Django environment.

Alex Jillard
  • 2,792
  • 2
  • 19
  • 20
0

You can use the sqlall predicate of manage.py to see the exact SQL that will be executed in order to generate the database.

Ignacio Vazquez-Abrams
  • 776,304
  • 153
  • 1,341
  • 1,358
0

Obviously django needs database tables for its basic functionality (contrib.apps).

Sure, you don't have to use them, but generally you want to use a least contrib.auth and some other bundled apps:

Each of these applications makes use of at least one database table, though, so we need to create the tables in the database before we can use them.

I any case you can't and shouldn't compare it to ugly html code generated by dreamweaver or word.


On a more abstract level:

One of key concepts of a web framework (following the mvc pattern) is that you define models which are "translated" (mapped) by the framework into database tables.

A model is the single, definitive source of data about your data. It contains the essential fields and behaviors of the data you’re storing. Generally, each model maps to a single database table.

If you want to create the whole database scheme by hand you totally missed the point of using a web framework. In most cases you simply don't need to write sql manually. You define your classes and then you can query your objects using the builtin orm.

arie
  • 18,737
  • 5
  • 70
  • 76
  • I know it needs database tables. I was wondering if it generates good clean database structure. Thank you for your response. – japhyr May 12 '11 at 06:29