Skip to content

Commit 4a313d2

Browse files
author
Rokas Balsys
committed
Creating 8th tutorial part
1 parent f9e45e3 commit 4a313d2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+34360
-0
lines changed

04_Django-custom-user/db.sqlite3

0 Bytes
Binary file not shown.

08_Django-messaging/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
venv
2+
*.pyc
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"name": "Python: Django",
9+
"type": "python",
10+
"request": "launch",
11+
"program": "${workspaceFolder}/manage.py",
12+
"args": [
13+
"runserver"
14+
],
15+
"django": true
16+
},
17+
]
18+
}

08_Django-messaging/bin/setup_env.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
python -m venv venv
2+
activate() {
3+
. venv/Sctripts/activate
4+
echo "installing requirements to virtual environment"
5+
pip install -r requirements.txt
6+
}
7+
activate
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
python3 -m venv venv
2+
activate() {
3+
. venv/bin/activate
4+
echo "installing requirements to virtual environment"
5+
pip install -r requirements.txt
6+
}
7+
activate

08_Django-messaging/db.sqlite3

172 KB
Binary file not shown.

08_Django-messaging/djang_website/__init__.py

Whitespace-only changes.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
"""
2+
ASGI config for djang_website project.
3+
4+
It exposes the ASGI callable as a module-level variable named ``application``.
5+
6+
For more information on this file, see
7+
https://docs.djangoproject.com/en/3.1/howto/deployment/asgi/
8+
"""
9+
10+
import os
11+
12+
from django.core.asgi import get_asgi_application
13+
14+
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'djang_website.settings')
15+
16+
application = get_asgi_application()
Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
"""
2+
Django settings for djang_website project.
3+
4+
Generated by 'django-admin startproject' using Django 3.1.7.
5+
6+
For more information on this file, see
7+
https://docs.djangoproject.com/en/3.1/topics/settings/
8+
9+
For the full list of settings and their values, see
10+
https://docs.djangoproject.com/en/3.1/ref/settings/
11+
"""
12+
13+
from pathlib import Path
14+
15+
# Build paths inside the project like this: BASE_DIR / 'subdir'.
16+
BASE_DIR = Path(__file__).resolve().parent.parent
17+
18+
19+
# Quick-start development settings - unsuitable for production
20+
# See https://docs.djangoproject.com/en/3.1/howto/deployment/checklist/
21+
22+
# SECURITY WARNING: keep the secret key used in production secret!
23+
SECRET_KEY = '(c@9=wl&3=c#nm@=5#hn$#dpw5zqm0vvmojfcr!d7%&7&ofz2n'
24+
25+
# SECURITY WARNING: don't run with debug turned on in production!
26+
DEBUG = True
27+
28+
ALLOWED_HOSTS = []
29+
30+
31+
# Application definition
32+
33+
INSTALLED_APPS = [
34+
'django.contrib.admin',
35+
'django.contrib.auth',
36+
'django.contrib.contenttypes',
37+
'django.contrib.sessions',
38+
'django.contrib.messages',
39+
'django.contrib.staticfiles',
40+
# Add our new application
41+
'main',
42+
'users',
43+
'tinymce',
44+
'fontawesomefree',
45+
'crispy_forms',
46+
]
47+
48+
AUTH_USER_MODEL = 'users.CustomUser'
49+
50+
MIDDLEWARE = [
51+
'django.middleware.security.SecurityMiddleware',
52+
'django.contrib.sessions.middleware.SessionMiddleware',
53+
'django.middleware.common.CommonMiddleware',
54+
'django.middleware.csrf.CsrfViewMiddleware',
55+
'django.contrib.auth.middleware.AuthenticationMiddleware',
56+
'django.contrib.messages.middleware.MessageMiddleware',
57+
'django.middleware.clickjacking.XFrameOptionsMiddleware',
58+
]
59+
60+
ROOT_URLCONF = 'djang_website.urls'
61+
62+
TEMPLATES = [
63+
{
64+
'BACKEND': 'django.template.backends.django.DjangoTemplates',
65+
'DIRS': [],
66+
'APP_DIRS': True,
67+
'OPTIONS': {
68+
'context_processors': [
69+
'django.template.context_processors.debug',
70+
'django.template.context_processors.request',
71+
'django.contrib.auth.context_processors.auth',
72+
'django.contrib.messages.context_processors.messages',
73+
],
74+
},
75+
},
76+
]
77+
78+
WSGI_APPLICATION = 'djang_website.wsgi.application'
79+
80+
81+
# Database
82+
# https://docs.djangoproject.com/en/3.1/ref/settings/#databases
83+
84+
DATABASES = {
85+
'default': {
86+
'ENGINE': 'django.db.backends.sqlite3',
87+
'NAME': BASE_DIR / 'db.sqlite3',
88+
}
89+
}
90+
91+
92+
# Password validation
93+
# https://docs.djangoproject.com/en/3.1/ref/settings/#auth-password-validators
94+
95+
AUTH_PASSWORD_VALIDATORS = [
96+
{
97+
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
98+
},
99+
{
100+
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
101+
},
102+
{
103+
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
104+
},
105+
{
106+
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
107+
},
108+
]
109+
110+
111+
# Internationalization
112+
# https://docs.djangoproject.com/en/3.1/topics/i18n/
113+
114+
LANGUAGE_CODE = 'en-us'
115+
116+
TIME_ZONE = 'UTC'
117+
118+
USE_I18N = True
119+
120+
USE_L10N = True
121+
122+
USE_TZ = True
123+
124+
125+
# Static files (CSS, JavaScript, Images)
126+
# https://docs.djangoproject.com/en/3.1/howto/static-files/
127+
128+
STATIC_URL = '/static/'
129+
130+
TINYMCE_DEFAULT_CONFIG = {
131+
'custom_undo_redo_levels': 100,
132+
'selector': 'textarea',
133+
"menubar": "file edit view insert format tools table help",
134+
'plugins': 'link image preview codesample contextmenu table code lists fullscreen',
135+
'toolbar1': 'undo redo | backcolor casechange permanentpen formatpainter removeformat formatselect fontselect fontsizeselect',
136+
'toolbar2': 'bold italic underline blockquote | alignleft aligncenter alignright alignjustify '
137+
'| bullist numlist | outdent indent | table | link image | codesample | preview code | tiny_mce_wiris_formulaEditor tiny_mce_wiris_formulaEditorChemistry',
138+
'contextmenu': 'formats | link image',
139+
'block_formats': 'Paragraph=p; Header 1=h1; Header 2=h2',
140+
'fontsize_formats': "8pt 10pt 12pt 14pt 16pt 18pt",
141+
'content_style': "body { font-family: Arial; background: white; color: black; font-size: 12pt}",
142+
'codesample_languages': [
143+
{'text': 'Python', 'value': 'python'}, {'text': 'HTML/XML', 'value': 'markup'},],
144+
'image_class_list': [{'title': 'Fluid', 'value': 'img-fluid', 'style': {} }],
145+
'width': 'auto',
146+
"height": "600px",
147+
'image_caption': True,
148+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
"""django_website URL Configuration
2+
3+
The `urlpatterns` list routes URLs to views. For more information please see:
4+
https://docs.djangoproject.com/en/3.1/topics/http/urls/
5+
Examples:
6+
Function views
7+
1. Add an import: from my_app import views
8+
2. Add a URL to urlpatterns: path('', views.home, name='home')
9+
Class-based views
10+
1. Add an import: from other_app.views import Home
11+
2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
12+
Including another URLconf
13+
1. Import the include() function: from django.urls import include, path
14+
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
15+
"""
16+
from django.conf import settings
17+
from django.conf.urls.static import static
18+
from django.contrib import admin
19+
from django.urls import path, include
20+
21+
urlpatterns = [
22+
path("", include('users.urls')),
23+
path("", include('main.urls')),
24+
path('admin/', admin.site.urls),
25+
path('tinymce/', include('tinymce.urls')),
26+
]
27+
if settings.DEBUG:
28+
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy