Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.

Commit 2fc29f8

Browse files
committed
Initial commit
0 parents  commit 2fc29f8

File tree

28 files changed

+591
-0
lines changed

28 files changed

+591
-0
lines changed

.gitignore

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# IDE project files
2+
.idea/
3+
4+
# Byte-compiled and optimized files
5+
__pycache__/
6+
*.py[cod]
7+
8+
# Distribution / packaging
9+
*.egg-info/
10+
11+
# Development databases
12+
db.sqlite3

CHANGELOG.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Changelog
2+
=========
3+
4+
1.0.0 (2017-xx-xx)
5+
----------------
6+
7+
* Initial release

LICENSE

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
Copyright (c) 2017, Timo Rieber <[email protected]>
2+
3+
Permission to use, copy, modify, and/or distribute this software for any
4+
purpose with or without fee is hereby granted, provided that the above
5+
copyright notice and this permission notice appear in all copies.
6+
7+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
8+
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
9+
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
10+
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
11+
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
12+
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
13+
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

README.rst

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
wagtail-pythonanywhere-quickstart
2+
=================================
3+
4+
.. image:: https://img.shields.io/badge/version-v1.0.0-blue.svg
5+
6+
.. image:: https://img.shields.io/badge/license-ISC%20License%20(ISCL)-blue.svg
7+
:target: http://en.wikipedia.org/wiki/ISC_license
8+
9+
`Wagtail CMS`_ quickstart for deployment on `PythonAnywhere`_
10+
11+
.. _Wagtail CMS: https://wagtail.io
12+
.. _PythonAnywhere: https://www.pythonanywhere.com
13+
14+
Prerequisites
15+
-------------
16+
* You have an account at `PythonAnywhere`_
17+
18+
.. _PythonAnywhere: https://www.pythonanywhere.com
19+
20+
Recommendations
21+
---------------
22+
* You use `virtualenv`_ for isolated local python development
23+
* You are familiar with the `Django`_ basics, at least visited their great `online tutorial`_
24+
25+
.. _virtualenv: https://virtualenv.pypa.io
26+
.. _Django: https://www.djangoproject.com
27+
.. _online tutorial: https://docs.djangoproject.com/en/dev/intro/tutorial01

home/__init__.py

Whitespace-only changes.

home/migrations/0001_initial.py

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

home/migrations/__init__.py

Whitespace-only changes.

home/models.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
from __future__ import absolute_import, unicode_literals
2+
3+
from django.db import models
4+
5+
from wagtail.wagtailcore.models import Page
6+
7+
8+
class HomePage(Page):
9+
pass

home/templates/home/home_page.html

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{% extends "base.html" %}
2+
3+
{% block body_class %}template-homepage{% endblock %}
4+
5+
{% block content %}
6+
<h1>Welcome to your new Wagtail site!</h1>
7+
8+
<p>You can access the admin interface <a href="{% url 'wagtailadmin_home' %}">here</a> (make sure you have run "./manage.py createsuperuser" in the console first).</p>
9+
10+
<p>If you haven't already given the documentation a read, head over to <a href="http://docs.wagtail.io/">http://docs.wagtail.io</a> to start building on Wagtail</p>
11+
{% endblock %}

0 commit comments

Comments
 (0)