diff --git a/config/settings.py b/config/settings.py index 624e8b9..9635ea7 100644 --- a/config/settings.py +++ b/config/settings.py @@ -55,7 +55,7 @@ ROOT_URLCONF = 'config.urls' TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', - 'DIRS': [], + 'DIRS': [BASE_DIR / "templates"], 'APP_DIRS': True, 'OPTIONS': { 'context_processors': [ @@ -117,6 +117,9 @@ USE_TZ = True # https://docs.djangoproject.com/en/5.1/howto/static-files/ STATIC_URL = 'static/' +STATICFILES_DIRS = [ + BASE_DIR / 'static', +] # Default primary key field type # https://docs.djangoproject.com/en/5.1/ref/settings/#default-auto-field diff --git a/config/urls.py b/config/urls.py index df178d9..4f44605 100644 --- a/config/urls.py +++ b/config/urls.py @@ -14,10 +14,15 @@ Including another URLconf 1. Import the include() function: from django.urls import include, path 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) """ +from django.conf import settings +from django.conf.urls.static import static from django.contrib import admin from django.urls import include, path urlpatterns = [ - path("gallery/", include("gallery.urls")), + path("", include("gallery.urls")), path('admin/', admin.site.urls), ] + +if settings.DEBUG: + urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) \ No newline at end of file diff --git a/gallery/templates/gallery/main.html b/gallery/templates/gallery/main.html new file mode 100644 index 0000000..25c58d4 --- /dev/null +++ b/gallery/templates/gallery/main.html @@ -0,0 +1,9 @@ +{% extends "base.html" %} + + +{% block title %} Galleria {% endblock %} + + +{% block content %} + Hello World! +{% endblock %} \ No newline at end of file diff --git a/gallery/urls.py b/gallery/urls.py index 2336905..dbde1a4 100644 --- a/gallery/urls.py +++ b/gallery/urls.py @@ -5,5 +5,6 @@ from . import views app_name = 'gallery' urlpatterns = [ - path("", views.index, name="index"), -] \ No newline at end of file + path('', views.Main.as_view(), name='main_url'), + +] diff --git a/gallery/views.py b/gallery/views.py index 072c89b..e5a2e27 100644 --- a/gallery/views.py +++ b/gallery/views.py @@ -1,9 +1,8 @@ -from django.http import HttpResponse from django.shortcuts import render +from django.views.generic import TemplateView # Create your views here. - -def index(request): - return HttpResponse("Hello, world.") \ No newline at end of file +class Main(TemplateView): + template_name = "gallery/main.html" \ No newline at end of file diff --git a/static/css/muistox.css b/static/css/muistox.css new file mode 100644 index 0000000..28d6177 --- /dev/null +++ b/static/css/muistox.css @@ -0,0 +1,3 @@ +body { + font: 400 14px/20px "Helvetica Neue",Helvetica,Arial,sans-serif; +} \ No newline at end of file diff --git a/static/js/muistox.js b/static/js/muistox.js new file mode 100644 index 0000000..139597f --- /dev/null +++ b/static/js/muistox.js @@ -0,0 +1,2 @@ + + diff --git a/templates/base.html b/templates/base.html new file mode 100644 index 0000000..17fee83 --- /dev/null +++ b/templates/base.html @@ -0,0 +1,25 @@ + + + + + {% load static %} + + + + + {% block title %} Gallery {% endblock %} + + + + + +
+ {% block content %} No Content {% endblock %} +
+ + + + + + + \ No newline at end of file