This repository has been archived by the owner on Feb 22, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 2fc29f8
Showing
28 changed files
with
591 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# IDE project files | ||
.idea/ | ||
|
||
# Byte-compiled and optimized files | ||
__pycache__/ | ||
*.py[cod] | ||
|
||
# Distribution / packaging | ||
*.egg-info/ | ||
|
||
# Development databases | ||
db.sqlite3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
Changelog | ||
========= | ||
|
||
1.0.0 (2017-xx-xx) | ||
---------------- | ||
|
||
* Initial release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
Copyright (c) 2017, Timo Rieber <trieber@texperience.de> | ||
|
||
Permission to use, copy, modify, and/or distribute this software for any | ||
purpose with or without fee is hereby granted, provided that the above | ||
copyright notice and this permission notice appear in all copies. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
wagtail-pythonanywhere-quickstart | ||
================================= | ||
|
||
.. image:: https://img.shields.io/badge/version-v1.0.0-blue.svg | ||
|
||
.. image:: https://img.shields.io/badge/license-ISC%20License%20(ISCL)-blue.svg | ||
:target: http://en.wikipedia.org/wiki/ISC_license | ||
|
||
`Wagtail CMS`_ quickstart for deployment on `PythonAnywhere`_ | ||
|
||
.. _Wagtail CMS: https://wagtail.io | ||
.. _PythonAnywhere: https://www.pythonanywhere.com | ||
|
||
Prerequisites | ||
------------- | ||
* You have an account at `PythonAnywhere`_ | ||
|
||
.. _PythonAnywhere: https://www.pythonanywhere.com | ||
|
||
Recommendations | ||
--------------- | ||
* You use `virtualenv`_ for isolated local python development | ||
* You are familiar with the `Django`_ basics, at least visited their great `online tutorial`_ | ||
|
||
.. _virtualenv: https://virtualenv.pypa.io | ||
.. _Django: https://www.djangoproject.com | ||
.. _online tutorial: https://docs.djangoproject.com/en/dev/intro/tutorial01 |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# -*- coding: utf-8 -*- | ||
from __future__ import unicode_literals | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('wagtailcore', '0040_page_draft_title'), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='HomePage', | ||
fields=[ | ||
('page_ptr', models.OneToOneField(on_delete=models.CASCADE, parent_link=True, auto_created=True, primary_key=True, serialize=False, to='wagtailcore.Page')), | ||
], | ||
options={ | ||
'abstract': False, | ||
}, | ||
bases=('wagtailcore.page',), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
# -*- coding: utf-8 -*- | ||
from __future__ import unicode_literals | ||
|
||
from django.db import migrations | ||
|
||
|
||
def create_homepage(apps, schema_editor): | ||
# Get models | ||
ContentType = apps.get_model('contenttypes.ContentType') | ||
Page = apps.get_model('wagtailcore.Page') | ||
Site = apps.get_model('wagtailcore.Site') | ||
HomePage = apps.get_model('home.HomePage') | ||
|
||
# Delete the default homepage | ||
# If migration is run multiple times, it may have already been deleted | ||
Page.objects.filter(id=2).delete() | ||
|
||
# Create content type for homepage model | ||
homepage_content_type, __ = ContentType.objects.get_or_create( | ||
model='homepage', app_label='home') | ||
|
||
# Create a new homepage | ||
homepage = HomePage.objects.create( | ||
title="Home", | ||
draft_title="Home", | ||
slug='home', | ||
content_type=homepage_content_type, | ||
path='00010001', | ||
depth=2, | ||
numchild=0, | ||
url_path='/home/', | ||
) | ||
|
||
# Create a site with the new homepage set as the root | ||
Site.objects.create( | ||
hostname='localhost', root_page=homepage, is_default_site=True) | ||
|
||
|
||
def remove_homepage(apps, schema_editor): | ||
# Get models | ||
ContentType = apps.get_model('contenttypes.ContentType') | ||
HomePage = apps.get_model('home.HomePage') | ||
|
||
# Delete the default homepage | ||
# Page and Site objects CASCADE | ||
HomePage.objects.filter(slug='home', depth=2).delete() | ||
|
||
# Delete content type for homepage model | ||
ContentType.objects.filter(model='homepage', app_label='home').delete() | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('home', '0001_initial'), | ||
] | ||
|
||
operations = [ | ||
migrations.RunPython(create_homepage, remove_homepage), | ||
] |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
from __future__ import absolute_import, unicode_literals | ||
|
||
from django.db import models | ||
|
||
from wagtail.wagtailcore.models import Page | ||
|
||
|
||
class HomePage(Page): | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{% extends "base.html" %} | ||
|
||
{% block body_class %}template-homepage{% endblock %} | ||
|
||
{% block content %} | ||
<h1>Welcome to your new Wagtail site!</h1> | ||
|
||
<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> | ||
|
||
<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> | ||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/usr/bin/env python | ||
from __future__ import absolute_import, unicode_literals | ||
|
||
import os | ||
import sys | ||
|
||
if __name__ == "__main__": | ||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mysite.settings.dev") | ||
|
||
from django.core.management import execute_from_command_line | ||
|
||
execute_from_command_line(sys.argv) |
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,142 @@ | ||
""" | ||
Django settings for mysite project. | ||
Generated by 'django-admin startproject' using Django 1.11.5. | ||
For more information on this file, see | ||
https://docs.djangoproject.com/en/1.11/topics/settings/ | ||
For the full list of settings and their values, see | ||
https://docs.djangoproject.com/en/1.11/ref/settings/ | ||
""" | ||
|
||
from __future__ import absolute_import, unicode_literals | ||
|
||
# Build paths inside the project like this: os.path.join(BASE_DIR, ...) | ||
import os | ||
|
||
PROJECT_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) | ||
BASE_DIR = os.path.dirname(PROJECT_DIR) | ||
|
||
|
||
# Quick-start development settings - unsuitable for production | ||
# See https://docs.djangoproject.com/en/1.11/howto/deployment/checklist/ | ||
|
||
|
||
# Application definition | ||
|
||
INSTALLED_APPS = [ | ||
'home', | ||
'search', | ||
|
||
'wagtail.wagtailforms', | ||
'wagtail.wagtailredirects', | ||
'wagtail.wagtailembeds', | ||
'wagtail.wagtailsites', | ||
'wagtail.wagtailusers', | ||
'wagtail.wagtailsnippets', | ||
'wagtail.wagtaildocs', | ||
'wagtail.wagtailimages', | ||
'wagtail.wagtailsearch', | ||
'wagtail.wagtailadmin', | ||
'wagtail.wagtailcore', | ||
|
||
'modelcluster', | ||
'taggit', | ||
|
||
'django.contrib.admin', | ||
'django.contrib.auth', | ||
'django.contrib.contenttypes', | ||
'django.contrib.sessions', | ||
'django.contrib.messages', | ||
'django.contrib.staticfiles', | ||
] | ||
|
||
MIDDLEWARE = [ | ||
'django.contrib.sessions.middleware.SessionMiddleware', | ||
'django.middleware.common.CommonMiddleware', | ||
'django.middleware.csrf.CsrfViewMiddleware', | ||
'django.contrib.auth.middleware.AuthenticationMiddleware', | ||
'django.contrib.auth.middleware.SessionAuthenticationMiddleware', | ||
'django.contrib.messages.middleware.MessageMiddleware', | ||
'django.middleware.clickjacking.XFrameOptionsMiddleware', | ||
'django.middleware.security.SecurityMiddleware', | ||
|
||
'wagtail.wagtailcore.middleware.SiteMiddleware', | ||
'wagtail.wagtailredirects.middleware.RedirectMiddleware', | ||
] | ||
|
||
ROOT_URLCONF = 'mysite.urls' | ||
|
||
TEMPLATES = [ | ||
{ | ||
'BACKEND': 'django.template.backends.django.DjangoTemplates', | ||
'DIRS': [ | ||
os.path.join(PROJECT_DIR, 'templates'), | ||
], | ||
'APP_DIRS': True, | ||
'OPTIONS': { | ||
'context_processors': [ | ||
'django.template.context_processors.debug', | ||
'django.template.context_processors.request', | ||
'django.contrib.auth.context_processors.auth', | ||
'django.contrib.messages.context_processors.messages', | ||
], | ||
}, | ||
}, | ||
] | ||
|
||
WSGI_APPLICATION = 'mysite.wsgi.application' | ||
|
||
|
||
# Database | ||
# https://docs.djangoproject.com/en/1.11/ref/settings/#databases | ||
|
||
DATABASES = { | ||
'default': { | ||
'ENGINE': 'django.db.backends.sqlite3', | ||
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), | ||
} | ||
} | ||
|
||
|
||
# Internationalization | ||
# https://docs.djangoproject.com/en/1.11/topics/i18n/ | ||
|
||
LANGUAGE_CODE = 'en-us' | ||
|
||
TIME_ZONE = 'UTC' | ||
|
||
USE_I18N = True | ||
|
||
USE_L10N = True | ||
|
||
USE_TZ = True | ||
|
||
|
||
# Static files (CSS, JavaScript, Images) | ||
# https://docs.djangoproject.com/en/1.11/howto/static-files/ | ||
|
||
STATICFILES_FINDERS = [ | ||
'django.contrib.staticfiles.finders.FileSystemFinder', | ||
'django.contrib.staticfiles.finders.AppDirectoriesFinder', | ||
] | ||
|
||
STATICFILES_DIRS = [ | ||
os.path.join(PROJECT_DIR, 'static'), | ||
] | ||
|
||
STATIC_ROOT = os.path.join(BASE_DIR, 'static') | ||
STATIC_URL = '/static/' | ||
|
||
MEDIA_ROOT = os.path.join(BASE_DIR, 'media') | ||
MEDIA_URL = '/media/' | ||
|
||
|
||
# Wagtail settings | ||
|
||
WAGTAIL_SITE_NAME = "mysite" | ||
|
||
# Base URL to use when referring to full URLs within the Wagtail admin backend - | ||
# e.g. in notification emails. Don't include '/admin' or a trailing slash | ||
BASE_URL = 'http://example.com' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
from __future__ import absolute_import, unicode_literals | ||
|
||
from .base import * | ||
|
||
# SECURITY WARNING: don't run with debug turned on in production! | ||
DEBUG = True | ||
|
||
# SECURITY WARNING: keep the secret key used in production secret! | ||
SECRET_KEY = '&@#s()$&74f78_ve9wkn0deca3&d1pnp*80y3ffoe3mij$_y*@' | ||
|
||
|
||
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend' | ||
|
||
|
||
try: | ||
from .local import * | ||
except ImportError: | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
from __future__ import absolute_import, unicode_literals | ||
|
||
from .base import * | ||
|
||
DEBUG = False | ||
|
||
try: | ||
from .local import * | ||
except ImportError: | ||
pass |
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{% extends "base.html" %} | ||
|
||
{% block body_class %}template-404{% endblock %} | ||
|
||
{% block content %} | ||
<h1>Page not found</h1> | ||
|
||
<h2>Sorry, this page could not be found.</h2> | ||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<!DOCTYPE html> | ||
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]--> | ||
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]--> | ||
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]--> | ||
<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]--> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge" /> | ||
<title>Internal server error</title> | ||
<meta name="viewport" content="width=device-width, initial-scale=1" /> | ||
</head> | ||
<body> | ||
<h1>Internal server error</h1> | ||
|
||
<h2>Sorry, there seems to be an error. Please try again soon.</h2> | ||
</body> | ||
</html> |
Oops, something went wrong.