i tried to render a html file, but it didn't work,
what do the urls.py path look like?
i followed theNetNinja but it didn't work
i tried to render a html file, but it didn't work,
what do the urls.py path look like?
i followed theNetNinja but it didn't work
For further actions, you may consider blocking this person and/or reporting abuse
Developer Service -
Abdikhafar -
Alessandro Pischedda -
Pranav Bakare -
Top comments (7)
Is this what you're talking about? For my site I just added templateViews as views. This puts the basic template at topmarq.com/about/ and uses the 'about.html' template. You can do the same with your home template.
Yes, how many different ways is there to doing that? It dosnt look like how several tutorials did it.
Hmm can you show the tutorial?
So this method assumes that you don't have a dedicated view function for this HTML file. This only makes sense for pages where no context is needed. Eg 'static' pages. If your 'home' page isn't static you'll need to create a view function, and then call that function.
For a page that is not static, I call it this way:
And then in the App, I have a views.py that has a 'view' like this:
class PopularThreadListView(ListView):
"""A basic ListView """
I’ve been watching “theNetNinja” Django tutorial. When do I make a migration?
Any time you change the structure of your database you will need to 'makemigrations' (creates a file that tells the DB what to change and how) and then 'migrate' (actually tells the DB to update).
For instance, if you change your 'User' model to now include their birthday as a datetime field, you would need to go through this process to add a column in the user Table to store the birthdays.
Ok, do I CD into anything or:
./venv/bin/activate
makemigrations
?
just be in the directory that contains your manage.py file.
Then run