Skip to content

Commit 2d2b010

Browse files
committed
wagtail start iogt
1 parent 4844c52 commit 2d2b010

27 files changed

+856
-0
lines changed

.dockerignore

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Django project
2+
/media/
3+
/static/
4+
*.sqlite3
5+
6+
# Python and others
7+
__pycache__
8+
*.pyc
9+
.DS_Store
10+
*.swp
11+
/venv/
12+
/tmp/
13+
/.vagrant/
14+
/Vagrantfile.local
15+
node_modules/
16+
/npm-debug.log
17+
/.idea/
18+
.vscode
19+
coverage
20+
.python-version
21+
22+
# Distribution / packaging
23+
.Python
24+
env/
25+
build/
26+
develop-eggs/
27+
dist/
28+
downloads/
29+
eggs/
30+
.eggs/
31+
lib/
32+
lib64/
33+
parts/
34+
sdist/
35+
var/
36+
wheels/
37+
*.egg-info/
38+
.installed.cfg
39+
*.egg

Dockerfile

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# Use an official Python runtime based on Debian 10 "buster" as a parent image.
2+
FROM python:3.8.1-slim-buster
3+
4+
# Add user that will be used in the container.
5+
RUN useradd wagtail
6+
7+
# Port used by this container to serve HTTP.
8+
EXPOSE 8000
9+
10+
# Set environment variables.
11+
# 1. Force Python stdout and stderr streams to be unbuffered.
12+
# 2. Set PORT variable that is used by Gunicorn. This should match "EXPOSE"
13+
# command.
14+
ENV PYTHONUNBUFFERED=1 \
15+
PORT=8000
16+
17+
# Install system packages required by Wagtail and Django.
18+
RUN apt-get update --yes --quiet && apt-get install --yes --quiet --no-install-recommends \
19+
build-essential \
20+
libpq-dev \
21+
libmariadbclient-dev \
22+
libjpeg62-turbo-dev \
23+
zlib1g-dev \
24+
libwebp-dev \
25+
&& rm -rf /var/lib/apt/lists/*
26+
27+
# Install the application server.
28+
RUN pip install "gunicorn==20.0.4"
29+
30+
# Install the project requirements.
31+
COPY requirements.txt /
32+
RUN pip install -r /requirements.txt
33+
34+
# Use /app folder as a directory where the source code is stored.
35+
WORKDIR /app
36+
37+
# Set this directory to be owned by the "wagtail" user. This Wagtail project
38+
# uses SQLite, the folder needs to be owned by the user that
39+
# will be writing to the database file.
40+
RUN chown wagtail:wagtail /app
41+
42+
# Copy the source code of the project into the container.
43+
COPY --chown=wagtail:wagtail . .
44+
45+
# Use user "wagtail" to run the build commands below and the server itself.
46+
USER wagtail
47+
48+
# Collect static files.
49+
RUN python manage.py collectstatic --noinput --clear
50+
51+
# Runtime command that executes when "docker run" is called, it does the
52+
# following:
53+
# 1. Migrate the database.
54+
# 2. Start the application server.
55+
# WARNING:
56+
# Migrating database at the same time as starting the server IS NOT THE BEST
57+
# PRACTICE. The database should be migrated manually or using the release
58+
# phase facilities of your hosting platform. This is used only so the
59+
# Wagtail instance can be started with a simple "docker run" command.
60+
CMD set -xe; python manage.py migrate --noinput; gunicorn iogt.wsgi:application

home/__init__.py

Whitespace-only changes.

home/migrations/0001_initial.py

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# -*- coding: utf-8 -*-
2+
from django.db import migrations, models
3+
4+
5+
class Migration(migrations.Migration):
6+
7+
dependencies = [
8+
('wagtailcore', '0040_page_draft_title'),
9+
]
10+
11+
operations = [
12+
migrations.CreateModel(
13+
name='HomePage',
14+
fields=[
15+
('page_ptr', models.OneToOneField(on_delete=models.CASCADE, parent_link=True, auto_created=True, primary_key=True, serialize=False, to='wagtailcore.Page')),
16+
],
17+
options={
18+
'abstract': False,
19+
},
20+
bases=('wagtailcore.page',),
21+
),
22+
]
+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# -*- coding: utf-8 -*-
2+
from django.db import migrations
3+
4+
5+
def create_homepage(apps, schema_editor):
6+
# Get models
7+
ContentType = apps.get_model('contenttypes.ContentType')
8+
Page = apps.get_model('wagtailcore.Page')
9+
Site = apps.get_model('wagtailcore.Site')
10+
HomePage = apps.get_model('home.HomePage')
11+
12+
# Delete the default homepage
13+
# If migration is run multiple times, it may have already been deleted
14+
Page.objects.filter(id=2).delete()
15+
16+
# Create content type for homepage model
17+
homepage_content_type, __ = ContentType.objects.get_or_create(
18+
model='homepage', app_label='home')
19+
20+
# Create a new homepage
21+
homepage = HomePage.objects.create(
22+
title="Home",
23+
draft_title="Home",
24+
slug='home',
25+
content_type=homepage_content_type,
26+
path='00010001',
27+
depth=2,
28+
numchild=0,
29+
url_path='/home/',
30+
)
31+
32+
# Create a site with the new homepage set as the root
33+
Site.objects.create(
34+
hostname='localhost', root_page=homepage, is_default_site=True)
35+
36+
37+
def remove_homepage(apps, schema_editor):
38+
# Get models
39+
ContentType = apps.get_model('contenttypes.ContentType')
40+
HomePage = apps.get_model('home.HomePage')
41+
42+
# Delete the default homepage
43+
# Page and Site objects CASCADE
44+
HomePage.objects.filter(slug='home', depth=2).delete()
45+
46+
# Delete content type for homepage model
47+
ContentType.objects.filter(model='homepage', app_label='home').delete()
48+
49+
50+
class Migration(migrations.Migration):
51+
52+
run_before = [
53+
('wagtailcore', '0053_locale_model'),
54+
]
55+
56+
dependencies = [
57+
('home', '0001_initial'),
58+
]
59+
60+
operations = [
61+
migrations.RunPython(create_homepage, remove_homepage),
62+
]

home/migrations/__init__.py

Whitespace-only changes.

home/models.py

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
from django.db import models
2+
3+
from wagtail.core.models import Page
4+
5+
6+
class HomePage(Page):
7+
pass

home/static/css/welcome_page.css

+204
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,204 @@
1+
html {
2+
box-sizing: border-box;
3+
}
4+
5+
*,
6+
*:before,
7+
*:after {
8+
box-sizing: inherit;
9+
}
10+
11+
body {
12+
max-width: 960px;
13+
min-height: 100vh;
14+
margin: 0 auto;
15+
padding: 0 15px;
16+
color: #231f20;
17+
font-family: 'Helvetica Neue', 'Segoe UI', Arial, sans-serif;
18+
line-height: 1.25;
19+
}
20+
21+
a {
22+
background-color: transparent;
23+
color: #308282;
24+
text-decoration: underline;
25+
}
26+
27+
a:hover {
28+
color: #ea1b10;
29+
}
30+
31+
h1,
32+
h2,
33+
h3,
34+
h4,
35+
h5,
36+
p,
37+
ul {
38+
padding: 0;
39+
margin: 0;
40+
font-weight: 400;
41+
}
42+
43+
main {
44+
display: block; /* For IE11 support */
45+
}
46+
47+
svg:not(:root) {
48+
overflow: hidden;
49+
}
50+
51+
.header {
52+
display: flex;
53+
justify-content: space-between;
54+
align-items: center;
55+
padding-top: 20px;
56+
padding-bottom: 10px;
57+
border-bottom: 1px solid #e6e6e6;
58+
}
59+
60+
.logo {
61+
width: 150px;
62+
margin-right: 20px;
63+
}
64+
65+
.logo a {
66+
display: block;
67+
}
68+
69+
.figure-logo {
70+
max-width: 150px;
71+
max-height: 55.1px;
72+
}
73+
74+
.release-notes {
75+
font-size: 14px;
76+
}
77+
78+
.main {
79+
padding: 40px 0;
80+
margin: 0 auto;
81+
text-align: center;
82+
}
83+
84+
.figure-space {
85+
max-width: 265px;
86+
}
87+
88+
@-webkit-keyframes pos {
89+
0%, 100% {
90+
-webkit-transform: rotate(-6deg);
91+
transform: rotate(-6deg);
92+
}
93+
50% {
94+
-webkit-transform: rotate(6deg);
95+
transform: rotate(6deg);
96+
}
97+
}
98+
99+
@keyframes pos {
100+
0%, 100% {
101+
-webkit-transform: rotate(-6deg);
102+
transform: rotate(-6deg);
103+
}
104+
50% {
105+
-webkit-transform: rotate(6deg);
106+
transform: rotate(6deg);
107+
}
108+
}
109+
110+
.egg {
111+
fill: #43b1b0;
112+
-webkit-animation: pos 3s ease infinite;
113+
animation: pos 3s ease infinite;
114+
-webkit-transform: translateY(50px);
115+
transform: translateY(50px);
116+
-webkit-transform-origin: 50% 80%;
117+
transform-origin: 50% 80%;
118+
}
119+
120+
.main-text {
121+
max-width: 400px;
122+
margin: 5px auto;
123+
}
124+
125+
.main-text h1 {
126+
font-size: 22px;
127+
}
128+
129+
.main-text p {
130+
margin: 15px auto 0;
131+
}
132+
133+
.footer {
134+
display: flex;
135+
flex-wrap: wrap;
136+
justify-content: space-between;
137+
border-top: 1px solid #e6e6e6;
138+
padding: 10px;
139+
}
140+
141+
.option {
142+
display: block;
143+
padding: 10px 10px 10px 34px;
144+
position: relative;
145+
text-decoration: none;
146+
}
147+
148+
.option svg {
149+
width: 24px;
150+
height: 24px;
151+
fill: gray;
152+
border: 1px solid #d9d9d9;
153+
padding: 5px;
154+
border-radius: 100%;
155+
top: 10px;
156+
left: 0;
157+
position: absolute;
158+
}
159+
160+
.option h4 {
161+
font-size: 19px;
162+
text-decoration: underline;
163+
}
164+
165+
.option p {
166+
padding-top: 3px;
167+
color: #231f20;
168+
font-size: 15px;
169+
font-weight: 300;
170+
}
171+
172+
@media (max-width: 996px) {
173+
body {
174+
max-width: 780px;
175+
}
176+
}
177+
178+
@media (max-width: 767px) {
179+
.option {
180+
flex: 0 0 50%;
181+
}
182+
}
183+
184+
@media (max-width: 599px) {
185+
.main {
186+
padding: 20px 0;
187+
}
188+
189+
.figure-space {
190+
max-width: 200px;
191+
}
192+
193+
.footer {
194+
display: block;
195+
width: 300px;
196+
margin: 0 auto;
197+
}
198+
}
199+
200+
@media (max-width: 360px) {
201+
.header-link {
202+
max-width: 100px;
203+
}
204+
}

0 commit comments

Comments
 (0)