diff --git a/.gitignore b/.gitignore index b6e4761..b97131e 100644 --- a/.gitignore +++ b/.gitignore @@ -127,3 +127,5 @@ dmypy.json # Pyre type checker .pyre/ + +.idea/ diff --git a/dnd_db_site/settings.py b/dnd_db_site/settings.py index ced426e..24c1bd6 100644 --- a/dnd_db_site/settings.py +++ b/dnd_db_site/settings.py @@ -10,6 +10,7 @@ For the full list of settings and their values, see https://docs.djangoproject.com/en/4.0/ref/settings/ """ +import os from pathlib import Path # Build paths inside the project like this: BASE_DIR / 'subdir'. @@ -32,6 +33,9 @@ ALLOWED_HOSTS = [env('HOST_1')] # Application definition INSTALLED_APPS = [ + 'main', + 'links', + 'faerun_calendar', 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', @@ -76,8 +80,12 @@ WSGI_APPLICATION = 'dnd_db_site.wsgi.application' DATABASES = { 'default': { - 'ENGINE': 'django.db.backends.sqlite3', - 'NAME': BASE_DIR / 'db.sqlite3', + 'ENGINE': 'django.db.backends.mysql', + 'NAME': env('DB_NAME'), + 'USER': env('DB_USER'), + 'PASSWORD': env('DB_PASSWORD'), + 'HOST': 'localhost', + 'PORT': '', } } @@ -104,7 +112,7 @@ AUTH_PASSWORD_VALIDATORS = [ # Internationalization # https://docs.djangoproject.com/en/4.0/topics/i18n/ -LANGUAGE_CODE = 'en-us' +LANGUAGE_CODE = 'ru-ru' TIME_ZONE = 'UTC' @@ -117,6 +125,10 @@ USE_TZ = True # https://docs.djangoproject.com/en/4.0/howto/static-files/ STATIC_URL = 'static/' +STATIC_ROOT = '/home/ruslan/dnd-db-site.misc/static' +STATICFILES_DIRS = [ + os.path.join(BASE_DIR, 'static'), +] # Default primary key field type # https://docs.djangoproject.com/en/4.0/ref/settings/#default-auto-field diff --git a/dnd_db_site/urls.py b/dnd_db_site/urls.py index b32ea59..cff4e56 100644 --- a/dnd_db_site/urls.py +++ b/dnd_db_site/urls.py @@ -15,8 +15,12 @@ Including another URLconf """ from django.contrib import admin from django.urls import include, path +from django.conf import settings +from django.conf.urls.static import static urlpatterns = [ path('admin/', admin.site.urls), - path('', include('helloworld.urls')), -] + path('', include('main.urls')), + path('calendar/', include('faerun_calendar.urls')), + path('links/', include('links.urls')), +] + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) diff --git a/helloworld/__init__.py b/faerun_calendar/__init__.py similarity index 100% rename from helloworld/__init__.py rename to faerun_calendar/__init__.py diff --git a/helloworld/admin.py b/faerun_calendar/admin.py similarity index 100% rename from helloworld/admin.py rename to faerun_calendar/admin.py diff --git a/faerun_calendar/apps.py b/faerun_calendar/apps.py new file mode 100644 index 0000000..5ba9dd7 --- /dev/null +++ b/faerun_calendar/apps.py @@ -0,0 +1,6 @@ +from django.apps import AppConfig + + +class FaerunCalendarConfig(AppConfig): + default_auto_field = 'django.db.models.BigAutoField' + name = 'faerun_calendar' diff --git a/helloworld/migrations/__init__.py b/faerun_calendar/migrations/__init__.py similarity index 100% rename from helloworld/migrations/__init__.py rename to faerun_calendar/migrations/__init__.py diff --git a/helloworld/models.py b/faerun_calendar/models.py similarity index 100% rename from helloworld/models.py rename to faerun_calendar/models.py diff --git a/faerun_calendar/static/faerun_calendar/css/main.css b/faerun_calendar/static/faerun_calendar/css/main.css new file mode 100644 index 0000000..30960ed --- /dev/null +++ b/faerun_calendar/static/faerun_calendar/css/main.css @@ -0,0 +1,39 @@ +div.calendarpage { + margin: 10px; + padding: 10px; + border: 1px solid black; + border-radius: 20px; +} + +table.month, table.month th, table.month td { + border: 1px solid white; + border-collapse: collapse; + padding: 5px; + background: gainsboro; +} + +table.month td { + text-align: right; +} + +table.month td.current { + background: dimgrey; + color: white; +} + +table.month th.subtitle { + font-style: italic; + font-weight: normal; +} + +div.calendar { + display: flex; + flex-flow: row wrap; + justify-content: space-around; +} + +table.month { + margin: 10px; + width: 350px; + max-width: 350px; +} diff --git a/faerun_calendar/templates/faerun_calendar/calendar.html b/faerun_calendar/templates/faerun_calendar/calendar.html new file mode 100644 index 0000000..992e9c8 --- /dev/null +++ b/faerun_calendar/templates/faerun_calendar/calendar.html @@ -0,0 +1,22 @@ +
+ {% include 'faerun_calendar/month.html' with title="Хаммер" subtitle="Глубокозимье" %} + {% include 'faerun_calendar/month.html' with title="Зимний солнцеворот" subtitle="Мертвозимье" oneday=1 %} + {% include 'faerun_calendar/month.html' with title="Альтурик" subtitle="Коготь зимы" %} + {% include 'faerun_calendar/month.html' with title="Чез" subtitle="Коготь закатов" %} + {% include 'faerun_calendar/month.html' with title="Тарсак" subtitle="Коготь бурь" %} + {% include 'faerun_calendar/month.html' with title="Зеленотравье" oneday=1 %} + + {% include 'faerun_calendar/month.html' with title="Миртул" subtitle="Таяние" %} + {% include 'faerun_calendar/month.html' with title="Кайторн" subtitle="Время цветов" %} + {% include 'faerun_calendar/month.html' with title="Флеймрул" subtitle="Разгар лета" %} + {% include 'faerun_calendar/month.html' with title="Летний солнцеворот" oneday=1 %} + {% include 'faerun_calendar/month.html' with title="Шильдмит*" oneday=1 %} + {% include 'faerun_calendar/month.html' with title="Элесис" subtitle="Солнцестояние" %} + + {% include 'faerun_calendar/month.html' with title="Элейнт" subtitle="Увядание" %} + {% include 'faerun_calendar/month.html' with title="Праздник урожая" oneday=1 %} + {% include 'faerun_calendar/month.html' with title="Марпенот" subtitle="Листопад" %} + {% include 'faerun_calendar/month.html' with title="Уктар" subtitle="Перегной" %} + {% include 'faerun_calendar/month.html' with title="Пир луны" oneday=1 %} + {% include 'faerun_calendar/month.html' with title="Найтал" subtitle="Спячка" %} +
diff --git a/faerun_calendar/templates/faerun_calendar/index.html b/faerun_calendar/templates/faerun_calendar/index.html new file mode 100644 index 0000000..cc3a8f3 --- /dev/null +++ b/faerun_calendar/templates/faerun_calendar/index.html @@ -0,0 +1,19 @@ +{% extends 'main/pagetemplate.html' %} + +{% load static %} + +{% block additional_css %} + +{% endblock %} + +{% block pagetitle %} +Календарь +{% endblock %} + +{% block content %} +
+

Календарь

+ {% include 'faerun_calendar/calendar.html' %} +
+{% endblock %} + diff --git a/faerun_calendar/templates/faerun_calendar/month.html b/faerun_calendar/templates/faerun_calendar/month.html new file mode 100644 index 0000000..9dd9a39 --- /dev/null +++ b/faerun_calendar/templates/faerun_calendar/month.html @@ -0,0 +1,53 @@ +
+ + + + + {% if subtitle %} + + {% endif %} + {% if oneday != 1 %} + + + + + + + + + + + + + + + + + + + + + + {% if title == "Миртул" %} + + {% else %} + + {% endif %} + + + + + + + + + + + + + + + + {% endif %} +
{{title}}
{{subtitle}}
12345678910
1112131415161718191920
21222324252627282930
+
diff --git a/helloworld/tests.py b/faerun_calendar/tests.py similarity index 100% rename from helloworld/tests.py rename to faerun_calendar/tests.py diff --git a/helloworld/urls.py b/faerun_calendar/urls.py similarity index 100% rename from helloworld/urls.py rename to faerun_calendar/urls.py diff --git a/faerun_calendar/views.py b/faerun_calendar/views.py new file mode 100644 index 0000000..7436291 --- /dev/null +++ b/faerun_calendar/views.py @@ -0,0 +1,6 @@ +from django.shortcuts import render + + +def index(request): + return render(request, 'faerun_calendar/index.html') + diff --git a/helloworld/views.py b/helloworld/views.py deleted file mode 100644 index e36da09..0000000 --- a/helloworld/views.py +++ /dev/null @@ -1,5 +0,0 @@ -from django.http import HttpResponse - -def index(request): - return HttpResponse('Hallo, Welt!') - diff --git a/links/__init__.py b/links/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/links/admin.py b/links/admin.py new file mode 100644 index 0000000..94c4246 --- /dev/null +++ b/links/admin.py @@ -0,0 +1,6 @@ +from django.contrib import admin +from .models import Link + +admin.site.register(Link) + + diff --git a/helloworld/apps.py b/links/apps.py similarity index 61% rename from helloworld/apps.py rename to links/apps.py index 4ebaf9c..a36c5c7 100644 --- a/helloworld/apps.py +++ b/links/apps.py @@ -1,6 +1,6 @@ from django.apps import AppConfig -class HelloworldConfig(AppConfig): +class LinksConfig(AppConfig): default_auto_field = 'django.db.models.BigAutoField' - name = 'helloworld' + name = 'links' diff --git a/links/migrations/__init__.py b/links/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/links/models.py b/links/models.py new file mode 100644 index 0000000..6d13fe8 --- /dev/null +++ b/links/models.py @@ -0,0 +1,10 @@ +from django.db import models + + +class Link(models.Model): + order = models.SmallIntegerField('Order') + url = models.CharField('URL', max_length=250) + text = models.CharField('Text', max_length=250) + + def __str__(self): + return f'({self.order}, {self.url}, {self.text})' diff --git a/links/static/links/css/main.css b/links/static/links/css/main.css new file mode 100644 index 0000000..7b62797 --- /dev/null +++ b/links/static/links/css/main.css @@ -0,0 +1,12 @@ +div.linkspage { + margin: 10px; + padding: 10px; + border: 1px solid black; + border-radius: 20px; +} + +ul { + list-style-type: none; + margin: 0; + padding: 0; +} diff --git a/links/templates/links/index.html b/links/templates/links/index.html new file mode 100644 index 0000000..cfc2499 --- /dev/null +++ b/links/templates/links/index.html @@ -0,0 +1,23 @@ +{% extends 'main/pagetemplate.html' %} + +{% load static %} + +{% block additional_css %} + +{% endblock %} + +{% block pagetitle %} +Полезные ссылки +{% endblock %} + +{% block content %} +
+

Полезные ссылки

+ +
+{% endblock %} + diff --git a/links/tests.py b/links/tests.py new file mode 100644 index 0000000..7ce503c --- /dev/null +++ b/links/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/links/urls.py b/links/urls.py new file mode 100644 index 0000000..4c9189f --- /dev/null +++ b/links/urls.py @@ -0,0 +1,8 @@ +from django.urls import path + +from . import views + +urlpatterns = [ + path('', views.index, name='index'), +] + diff --git a/links/views.py b/links/views.py new file mode 100644 index 0000000..58d2aa4 --- /dev/null +++ b/links/views.py @@ -0,0 +1,8 @@ +from django.shortcuts import render +from .models import Link + + +def index(request): + links = Link.objects.order_by('order') + + return render(request, 'links/index.html', {'links': links}) \ No newline at end of file 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/static/main/css/main.css b/main/static/main/css/main.css new file mode 100644 index 0000000..e04a5ca --- /dev/null +++ b/main/static/main/css/main.css @@ -0,0 +1,44 @@ +div.mainpage { + margin: 10px; + padding: 10px; + border: 1px solid black; + border-radius: 20px; +} + +aside.menu { + border: 3px solid black; + border-radius: 10px; + display: flex; + flex-direction: column; + padding: 15px; + margin: 25px; +} + +div.menu { + display: flex; + flex-flow: row wrap; +} + +aside.menu a { + border-radius: 10px; + text-decoration: none; + color: black; + font-weight: bold; + background: DeepSkyBlue; + padding: 10px; + margin: 10px; + + max-width: 100px; + max-width: 200px; + + display: flex; + flex: 1 1 0px; + flex-grow: 1; + + justify-content: center; + align-items: center; +} + +aside.menu a:hover { + background: DodgerBlue; +} \ No newline at end of file diff --git a/main/templates/main/index.html b/main/templates/main/index.html new file mode 100644 index 0000000..5547848 --- /dev/null +++ b/main/templates/main/index.html @@ -0,0 +1,11 @@ +{% extends 'main/pagetemplate.html' %} + +{% block pagetitle %} +Главная страница +{% endblock %} + +{% block content %} +
+

Главная страница

+
+{% endblock %} \ No newline at end of file diff --git a/main/templates/main/pagetemplate.html b/main/templates/main/pagetemplate.html new file mode 100644 index 0000000..a7d92e4 --- /dev/null +++ b/main/templates/main/pagetemplate.html @@ -0,0 +1,38 @@ + + +{% load static %} + + + + + {% block pagetitle %}{% endblock %} + + + + + {% block additional_css %} + {% endblock %} + + + + + + + + + {% block content %} + {% endblock %} + + \ No newline at end of file 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..4c9189f --- /dev/null +++ b/main/urls.py @@ -0,0 +1,8 @@ +from django.urls import path + +from . import views + +urlpatterns = [ + path('', views.index, name='index'), +] + diff --git a/main/views.py b/main/views.py new file mode 100644 index 0000000..29a00de --- /dev/null +++ b/main/views.py @@ -0,0 +1,5 @@ +from django.shortcuts import render + + +def index(request): + return render(request, 'main/index.html') diff --git a/static/iconbig.png b/static/iconbig.png new file mode 100644 index 0000000..6759c51 Binary files /dev/null and b/static/iconbig.png differ diff --git a/static/iconsmall.png b/static/iconsmall.png new file mode 100644 index 0000000..6a4bf44 Binary files /dev/null and b/static/iconsmall.png differ diff --git a/static/ookona.html b/static/ookona.html new file mode 100644 index 0000000..52873b7 --- /dev/null +++ b/static/ookona.html @@ -0,0 +1,339 @@ + + + + + + + + + +

Оокона

+ +
+ +

+

+ Имя: +
+
+ Класс: +
+

+ +
+ +

+ +

+ Осталось: +
+ +

+ +
+ +

+ +

+ Осталось (осн/доп): / +
+ +

+ + + + + +