简体   繁体   中英

Best way of integrating url addresses from database to django url patterns

I'm currently playing with django to get acquainted with it. I want to build a litte cms by myself. In an apps model i define a string database-field which represents the url, a field for the bodytext etc. Now i wonder what would be the best way to integrate the url and its corresponding content from the set of data.

Do I have to use views.py for sending database-fields with url data to urls.py? Is it better to process a database query within urls.py to get the urls?

I hope you can follow me... Thanks a lot

I've read this question several times and I'm still not sure exactly what you're asking.

The tutorial tells you exactly how to resolve addresses to db entries: capture the components of the URL in your urlconf, pass them to the view, and query your models in the view dependent on the parameters passed from the URL. If this doesn't answer your question, you'll need to explain further what's puzzling you.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM