The website app is a Django application designed to manage basic web pages within a website.
-
Add "website" to your
INSTALLED_APPS
in your Django project's settings:INSTALLED_APPS = [ ... 'website', ]
-
Include the website URLconf in your project urls.py like this:: you may want to add some url path inside the ''
path('', include(('website.urls', 'website'), namespace="website")),
-
Run
python manage.py migrate website
to create the website models. -
Start the development server and visit http://127.0.0.1:8000/admin/ to create the models (you'll need the Admin app enabled).
-
Visit http://127.0.0.1:8000 to see the website
if you want to use the article links outside the app you need to use the namespace. it is always a good idea when having many apps inside a Django project to use the namespace. for example:
> <a href="{% url 'website:URL' %}"</a>
...
To enable user registration and authentication, follow these steps:
-
Add
'django.contrib.auth'
and'django.contrib.auth.urls'
to yourINSTALLED_APPS
in your Django project's settings:INSTALLED_APPS = [ ... 'django.contrib.auth', ... ]
-
Include the authentication URLconf in your project's urls.py:
path('accounts/', include('django.contrib.auth.urls')),
Now, your website should have user registration and authentication functionality. For more advanced features, refer to the Django Authentication documentation.