Dear Monte,
Don't consider me an expert but here is how you may want to handle this scenario.
1. django-admin.py startproject tournaments
Now, cd into the 'tournaments' directory (wherein you have a manage.py file). From that directory you can create as many different apps (actually "components") of your tournaments project.
So, you do:
python manage.py startapp competitors
python manage.py startapp eventshandler
python manage.py startapp scoreboard
Each of these apps will handle each set of data and activities you outlined above.
Each app may also have its own set of templates (e.g. competitors/templates/), static assets for JS, CSS, etc. (e.g. competitors/static) and, of course the necessary models, views, urls, admin, etc. modules as needed.
This might be the best way to approach it.
However, you may also choose to share put all your templates or static assets in one app and have all other apps fetch them from there. For example, you may put all your CSS and JS files in competitors/static/ .
The separation of code and content into various apps is simply to help you better organize your project in a way that is simple and makes sense to you. But if your preference is different for a particular project or something else makes sense to you, you may fee free to do so as long as you know what you are doing and done break your code along the way.
If you haven't already done so, I would advise that you go over the official Django tutorial at https://docs.djangoproject.com/en/1.9/intro/ . While working through it just remember that you can do with/to each of your apps what you did to the "polls" app in that tutorial.
I hope this helps in some way.
All the best. :)
Sincerely,
Muhammad
On Thu, Nov 19, 2015 at 11:16 PM, memilanuk <memilanuk@gmail.com> wrote:
So... if I'm understanding things correctly, a Django 'project' can have multiple 'apps' in it, and these 'apps' can be reused to some extent between projects. As in: copy the folder of code for an 'app' from one project to another (editing things as needed for the new project)?
An app can either have its own style/templates, or it can use the 'project' templates / CSS, correct?
Maybe I haven't came across it yet... but how do you tie the different apps of a project together? How does the
As an example... lets say I want to set up a web site for running sports tournaments. One 'app' might be the competitor information, sort of like a contact / address book. Another might be for setting up specific events, and another would be for entering the scores and doing various things with them (validating, enforcing bounds / constraints, calculating aggregates, breaking ties, publishing results). The specific functions are distinct enough it seems like they would each be separate apps, but they all need to access the same database, possibly the same tables to get the information that one app or another needs. This seems to be where my (admittedly very basic) understanding of how Django works pretty much falls apart...
Thanks,
Monte
--
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+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@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/n2m6qk%249u3%241%40ger.gmane.org.
For more options, visit https://groups.google.com/d/optout.
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+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@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/CAJOFuZz5vwkF9eJqX%2BEMMaYktMn1Jmk8HWk6EMzoTVKVrTBRbg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment