diff --git a/kristofersxyz/settings.py b/kristofersxyz/settings.py index 6f17068..40cd03a 100644 --- a/kristofersxyz/settings.py +++ b/kristofersxyz/settings.py @@ -41,6 +41,7 @@ INSTALLED_APPS = [ 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', + 'main', ] MIDDLEWARE = [ @@ -58,7 +59,7 @@ ROOT_URLCONF = 'kristofersxyz.urls' TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', - 'DIRS': [], + 'DIRS': ['templates'], 'APP_DIRS': True, 'OPTIONS': { 'context_processors': [ @@ -109,7 +110,7 @@ AUTH_PASSWORD_VALIDATORS = [ LANGUAGE_CODE = 'en-us' -TIME_ZONE = 'UTC' +TIME_ZONE = 'Europe/Riga' USE_I18N = True @@ -119,8 +120,12 @@ USE_TZ = True # Static files (CSS, JavaScript, Images) # https://docs.djangoproject.com/en/4.0/howto/static-files/ -STATIC_URL = 'static/' +STATIC_URL = '/static/' + +STATICFILES_DIRS = ( + Path.joinpath(BASE_DIR, 'static'), +) # Default primary key field type # https://docs.djangoproject.com/en/4.0/ref/settings/#default-auto-field diff --git a/kristofersxyz/urls.py b/kristofersxyz/urls.py index b7cc3ba..d5c56f0 100644 --- a/kristofersxyz/urls.py +++ b/kristofersxyz/urls.py @@ -14,8 +14,11 @@ Including another URLconf 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) """ from django.contrib import admin -from django.urls import path +from django.urls import path, include +from django.conf import settings +from django.conf.urls.static import static urlpatterns = [ path('admin/', admin.site.urls), -] + path('', include('main.urls')), +] + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) diff --git a/main/__init__.py b/main/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/main/admin.py b/main/admin.py new file mode 100644 index 0000000..8c38f3f --- /dev/null +++ b/main/admin.py @@ -0,0 +1,3 @@ +from django.contrib import admin + +# Register your models here. diff --git a/main/apps.py b/main/apps.py new file mode 100644 index 0000000..167f044 --- /dev/null +++ b/main/apps.py @@ -0,0 +1,6 @@ +from django.apps import AppConfig + + +class MainConfig(AppConfig): + default_auto_field = 'django.db.models.BigAutoField' + name = 'main' diff --git a/main/migrations/__init__.py b/main/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/main/models.py b/main/models.py new file mode 100644 index 0000000..71a8362 --- /dev/null +++ b/main/models.py @@ -0,0 +1,3 @@ +from django.db import models + +# Create your models here. diff --git a/main/tests.py b/main/tests.py new file mode 100644 index 0000000..7ce503c --- /dev/null +++ b/main/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/main/urls.py b/main/urls.py new file mode 100644 index 0000000..b0fbbf5 --- /dev/null +++ b/main/urls.py @@ -0,0 +1,6 @@ +from django.urls import path +from . import views + +urlpatterns = [ + path('', views.index, name='home'), +] diff --git a/main/views.py b/main/views.py new file mode 100644 index 0000000..bfd56a2 --- /dev/null +++ b/main/views.py @@ -0,0 +1,6 @@ +from django.shortcuts import render + + +def index(request): + """Homepage""" + return render(request, 'main/index.html', {'title': 'Homepage'}) diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..d50d127 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,4 @@ +asgiref==3.5.2 +Django==4.1 +python-dotenv==0.20.0 +sqlparse==0.4.2 diff --git a/static/css/layout.css b/static/css/layout.css new file mode 100644 index 0000000..2ae4117 --- /dev/null +++ b/static/css/layout.css @@ -0,0 +1,162 @@ +html, +body, +div, +span, +applet, +object, +iframe, +h1, +h2, +h3, +h4, +h5, +h6, +p, +blockquote, +pre, +a, +abbr, +acronym, +address, +big, +cite, +code, +del, +dfn, +em, +img, +ins, +kbd, +q, +s, +samp, +small, +strike, +strong, +sub, +sup, +tt, +var, +b, +u, +i, +center, +dl, +dt, +dd, +ol, +ul, +li, +fieldset, +form, +label, +legend, +table, +caption, +tbody, +tfoot, +thead, +tr, +th, +td, +article, +aside, +canvas, +details, +embed, +figure, +figcaption, +footer, +header, +hgroup, +menu, +nav, +output, +ruby, +section, +summary, +time, +mark, +audio, +video { + margin: 0; + padding: 0; + border: 0; + vertical-align: baseline; +} + +html, +body { + font-family: 'Roboto', sans-serif; + background: #f2f2f2; +} + +main { + min-height: 100%; +} + +/* HEADER */ + +header ul { + list-style-type: none; + overflow: hidden; + background-color: #333333; + position: sticky; + position: -webkit-sticky; + top: 0; + text-align: center; + z-index: 100; + font-weight: bold; + width: 100%; +} + +.material-icons { + position: relative; + top: 4px; + font-size: 25px; +} + +li { + font-size: 18px; + float: left; + display: inline-block; + width: 20%; +} + +li a { + display: inline-block; + color: #cccccc; + padding: 14px 16px; + text-decoration: none; + transition: transform 0.7s ease; +} + +li a:hover { + text-decoration: none; + color: #fff; + transform: scale(1.05); +} + +/* FOOTER */ + +.page-container { + position: relative; + min-height: 100vh; +} + +.content-wrap { + padding-bottom: 2.5rem; +} + +footer { + position: absolute; + bottom: 0; + width: 100%; + height: auto; + background-color: #333333; + color: #666666; + flex-wrap: wrap; + display: flex; + justify-content: space-around; + padding: 8px 0; +} diff --git a/templates/layout.html b/templates/layout.html new file mode 100644 index 0000000..3b8d9ad --- /dev/null +++ b/templates/layout.html @@ -0,0 +1,44 @@ +{% load static %} + + + + + + + {% block title %}{% endblock %} + + + + + +
+
+ +
+
+ +
+
+ +
{% block content %}{% endblock %}
+ + + +
+
+ + + diff --git a/templates/main/index.html b/templates/main/index.html new file mode 100644 index 0000000..f72e0fe --- /dev/null +++ b/templates/main/index.html @@ -0,0 +1,8 @@ +{% extends 'layout.html' %} +{% block title %} {{ title }} {% endblock %} +{% block content %} +
+

Lorem ipsum dolor sit amet, qui minim labore adipisicing minim sint cillum sint consectetur cupidatat.

+

Lorem ipsum dolor sit amet, officia excepteur ex fugiat reprehenderit enim labore culpa sint ad nisi Lorem pariatur mollit ex esse exercitation amet. Nisi anim cupidatat excepteur officia. Reprehenderit nostrud nostrud ipsum Lorem est aliquip amet voluptate voluptate dolor minim nulla est proident. Nostrud officia pariatur ut officia. Sit irure elit esse ea nulla sunt ex occaecat reprehenderit commodo officia dolor Lorem duis laboris cupidatat officia voluptate. Culpa proident adipisicing id nulla nisi laboris ex in Lorem sunt duis officia eiusmod. Aliqua reprehenderit commodo ex non excepteur duis sunt velit enim. Voluptate laboris sint cupidatat ullamco ut ea consectetur et est culpa et culpa duis.

+
+{% endblock %}