diff --git a/Procfile b/Procfile index 4b09dae..541c935 100644 --- a/Procfile +++ b/Procfile @@ -1,2 +1,2 @@ release: yes "yes" | python manage.py migrate -web: uwsgi --http :$PORT --module bakerydemo.heroku_wsgi --master --offload-threads 1 +web: gunicorn bakerydemo.heroku_wsgi --log-file - diff --git a/bakerydemo/base/blocks.py b/bakerydemo/base/blocks.py index 6803330..7dfa085 100644 --- a/bakerydemo/base/blocks.py +++ b/bakerydemo/base/blocks.py @@ -40,7 +40,7 @@ class BlockQuote(StructBlock): """ Custom `StructBlock` that allows the user to attribute a quote to the author """ - text = TextBlock(), + text = TextBlock() attribute_name = CharBlock( blank=True, required=False, label='e.g. Guy Picciotto') @@ -54,6 +54,7 @@ class BaseStreamBlock(StreamBlock): """ Define the custom blocks that `StreamField` will utilize """ + intro_block = TextBlock() heading_block = HeadingBlock() paragraph_block = RichTextBlock( icon="fa-paragraph", diff --git a/bakerydemo/base/migrations/0005_merge_20170210_1539.py b/bakerydemo/base/migrations/0005_merge_20170210_1539.py new file mode 100644 index 0000000..402d96c --- /dev/null +++ b/bakerydemo/base/migrations/0005_merge_20170210_1539.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.10.5 on 2017-02-10 15:39 +from __future__ import unicode_literals + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('base', '0004_auto_20170210_1445'), + ('base', '0004_auto_20170210_1420'), + ] + + operations = [ + ] diff --git a/bakerydemo/base/migrations/0006_auto_20170210_1556.py b/bakerydemo/base/migrations/0006_auto_20170210_1556.py new file mode 100644 index 0000000..de12a85 --- /dev/null +++ b/bakerydemo/base/migrations/0006_auto_20170210_1556.py @@ -0,0 +1,34 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.10.5 on 2017-02-10 15:56 +from __future__ import unicode_literals + +from django.db import migrations +import wagtail.wagtailcore.blocks +import wagtail.wagtailcore.fields +import wagtail.wagtailembeds.blocks +import wagtail.wagtailimages.blocks + + +class Migration(migrations.Migration): + + dependencies = [ + ('base', '0005_merge_20170210_1539'), + ] + + operations = [ + migrations.AlterField( + model_name='aboutpage', + name='body', + field=wagtail.wagtailcore.fields.StreamField([(b'intro_block', wagtail.wagtailcore.blocks.TextBlock()), (b'heading_block', wagtail.wagtailcore.blocks.StructBlock([(b'heading_text', wagtail.wagtailcore.blocks.CharBlock(classname=b'title', required=True)), (b'size', wagtail.wagtailcore.blocks.ChoiceBlock(blank=True, choices=[(b'', b'Select a header size'), (b'h2', b'H2'), (b'h3', b'H3'), (b'h4', b'H4')], required=False))])), (b'paragraph_block', wagtail.wagtailcore.blocks.RichTextBlock(icon=b'fa-paragraph', template=b'blocks/paragraph_block.html')), (b'image_block', wagtail.wagtailcore.blocks.StructBlock([(b'image', wagtail.wagtailimages.blocks.ImageChooserBlock(required=True)), (b'caption', wagtail.wagtailcore.blocks.CharBlock(required=False)), (b'attribution', wagtail.wagtailcore.blocks.CharBlock(required=False))])), (b'block_quote', wagtail.wagtailcore.blocks.StructBlock([(b'text', wagtail.wagtailcore.blocks.TextBlock()), (b'attribute_name', wagtail.wagtailcore.blocks.CharBlock(blank=True, label=b'e.g. Guy Picciotto', required=False))])), (b'embed_block', wagtail.wagtailembeds.blocks.EmbedBlock(help_text=b'Insert an embed URL e.g https://www.youtube.com/embed/SGJFWirQ3ks', icon=b'fa-s15', template=b'blocks/embed_block.html'))], blank=True, verbose_name='About page detail'), + ), + migrations.AlterField( + model_name='formpage', + name='body', + field=wagtail.wagtailcore.fields.StreamField([(b'intro_block', wagtail.wagtailcore.blocks.TextBlock()), (b'heading_block', wagtail.wagtailcore.blocks.StructBlock([(b'heading_text', wagtail.wagtailcore.blocks.CharBlock(classname=b'title', required=True)), (b'size', wagtail.wagtailcore.blocks.ChoiceBlock(blank=True, choices=[(b'', b'Select a header size'), (b'h2', b'H2'), (b'h3', b'H3'), (b'h4', b'H4')], required=False))])), (b'paragraph_block', wagtail.wagtailcore.blocks.RichTextBlock(icon=b'fa-paragraph', template=b'blocks/paragraph_block.html')), (b'image_block', wagtail.wagtailcore.blocks.StructBlock([(b'image', wagtail.wagtailimages.blocks.ImageChooserBlock(required=True)), (b'caption', wagtail.wagtailcore.blocks.CharBlock(required=False)), (b'attribution', wagtail.wagtailcore.blocks.CharBlock(required=False))])), (b'block_quote', wagtail.wagtailcore.blocks.StructBlock([(b'text', wagtail.wagtailcore.blocks.TextBlock()), (b'attribute_name', wagtail.wagtailcore.blocks.CharBlock(blank=True, label=b'e.g. Guy Picciotto', required=False))])), (b'embed_block', wagtail.wagtailembeds.blocks.EmbedBlock(help_text=b'Insert an embed URL e.g https://www.youtube.com/embed/SGJFWirQ3ks', icon=b'fa-s15', template=b'blocks/embed_block.html'))]), + ), + migrations.AlterField( + model_name='homepage', + name='body', + field=wagtail.wagtailcore.fields.StreamField([(b'intro_block', wagtail.wagtailcore.blocks.TextBlock()), (b'heading_block', wagtail.wagtailcore.blocks.StructBlock([(b'heading_text', wagtail.wagtailcore.blocks.CharBlock(classname=b'title', required=True)), (b'size', wagtail.wagtailcore.blocks.ChoiceBlock(blank=True, choices=[(b'', b'Select a header size'), (b'h2', b'H2'), (b'h3', b'H3'), (b'h4', b'H4')], required=False))])), (b'paragraph_block', wagtail.wagtailcore.blocks.RichTextBlock(icon=b'fa-paragraph', template=b'blocks/paragraph_block.html')), (b'image_block', wagtail.wagtailcore.blocks.StructBlock([(b'image', wagtail.wagtailimages.blocks.ImageChooserBlock(required=True)), (b'caption', wagtail.wagtailcore.blocks.CharBlock(required=False)), (b'attribution', wagtail.wagtailcore.blocks.CharBlock(required=False))])), (b'block_quote', wagtail.wagtailcore.blocks.StructBlock([(b'text', wagtail.wagtailcore.blocks.TextBlock()), (b'attribute_name', wagtail.wagtailcore.blocks.CharBlock(blank=True, label=b'e.g. Guy Picciotto', required=False))])), (b'embed_block', wagtail.wagtailembeds.blocks.EmbedBlock(help_text=b'Insert an embed URL e.g https://www.youtube.com/embed/SGJFWirQ3ks', icon=b'fa-s15', template=b'blocks/embed_block.html'))], blank=True, verbose_name='Home page detail'), + ), + ] diff --git a/bakerydemo/blog/migrations/0002_auto_20170210_1556.py b/bakerydemo/blog/migrations/0002_auto_20170210_1556.py new file mode 100644 index 0000000..9a8899b --- /dev/null +++ b/bakerydemo/blog/migrations/0002_auto_20170210_1556.py @@ -0,0 +1,29 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.10.5 on 2017-02-10 15:56 +from __future__ import unicode_literals + +from django.db import migrations, models +import wagtail.wagtailcore.blocks +import wagtail.wagtailcore.fields +import wagtail.wagtailembeds.blocks +import wagtail.wagtailimages.blocks + + +class Migration(migrations.Migration): + + dependencies = [ + ('blog', '0001_initial'), + ] + + operations = [ + migrations.AddField( + model_name='blogpage', + name='subtitle', + field=models.CharField(blank=True, max_length=255), + ), + migrations.AlterField( + model_name='blogpage', + name='body', + field=wagtail.wagtailcore.fields.StreamField([(b'intro_block', wagtail.wagtailcore.blocks.TextBlock()), (b'heading_block', wagtail.wagtailcore.blocks.StructBlock([(b'heading_text', wagtail.wagtailcore.blocks.CharBlock(classname=b'title', required=True)), (b'size', wagtail.wagtailcore.blocks.ChoiceBlock(blank=True, choices=[(b'', b'Select a header size'), (b'h2', b'H2'), (b'h3', b'H3'), (b'h4', b'H4')], required=False))])), (b'paragraph_block', wagtail.wagtailcore.blocks.RichTextBlock(icon=b'fa-paragraph', template=b'blocks/paragraph_block.html')), (b'image_block', wagtail.wagtailcore.blocks.StructBlock([(b'image', wagtail.wagtailimages.blocks.ImageChooserBlock(required=True)), (b'caption', wagtail.wagtailcore.blocks.CharBlock(required=False)), (b'attribution', wagtail.wagtailcore.blocks.CharBlock(required=False))])), (b'block_quote', wagtail.wagtailcore.blocks.StructBlock([(b'text', wagtail.wagtailcore.blocks.TextBlock()), (b'attribute_name', wagtail.wagtailcore.blocks.CharBlock(blank=True, label=b'e.g. Guy Picciotto', required=False))])), (b'embed_block', wagtail.wagtailembeds.blocks.EmbedBlock(help_text=b'Insert an embed URL e.g https://www.youtube.com/embed/SGJFWirQ3ks', icon=b'fa-s15', template=b'blocks/embed_block.html'))], blank=True, verbose_name='Blog post'), + ), + ] diff --git a/bakerydemo/blog/models.py b/bakerydemo/blog/models.py index 5be7174..d914db0 100644 --- a/bakerydemo/blog/models.py +++ b/bakerydemo/blog/models.py @@ -46,6 +46,7 @@ class BlogPage(Page): """ A Blog Page (Post) """ + subtitle = models.CharField(blank=True, max_length=255) image = models.ForeignKey( 'wagtailimages.Image', null=True, @@ -64,6 +65,7 @@ class BlogPage(Page): ) content_panels = Page.content_panels + [ + FieldPanel('subtitle'), ImageChooserPanel('image'), StreamFieldPanel('body'), FieldPanel('date_published'), diff --git a/bakerydemo/heroku_wsgi.py b/bakerydemo/heroku_wsgi.py index 743f5e4..f945f5a 100644 --- a/bakerydemo/heroku_wsgi.py +++ b/bakerydemo/heroku_wsgi.py @@ -1,6 +1,5 @@ +from django.core.wsgi import get_wsgi_application from whitenoise.django import DjangoWhiteNoise -from .wsgi import application as _application - - -application = DjangoWhiteNoise(_application) +application = get_wsgi_application() +application = DjangoWhiteNoise(application) diff --git a/bakerydemo/settings/heroku.py b/bakerydemo/settings/heroku.py index 9ddeef6..67890b8 100644 --- a/bakerydemo/settings/heroku.py +++ b/bakerydemo/settings/heroku.py @@ -15,8 +15,13 @@ EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend' # BASE_URL required for notification emails BASE_URL = 'http://localhost:8000' -DATABASES = {'default': dj_database_url.config(default='postgres://postgres@localhost:5432/wagtaildemo')} +db_from_env = dj_database_url.config(conn_max_age=500) +DATABASES['default'].update(db_from_env) +# Simplified static file serving. +# https://warehouse.python.org/project/whitenoise/ + +STATICFILES_STORAGE = 'whitenoise.django.GzipManifestStaticFilesStorage' try: from .local import * diff --git a/bakerydemo/static/css/main2.css b/bakerydemo/static/css/main2.css new file mode 100644 index 0000000..6e4724f --- /dev/null +++ b/bakerydemo/static/css/main2.css @@ -0,0 +1,5 @@ +.hero{ + height: 600px; + background-size: cover; + background-position: center; +} \ No newline at end of file diff --git a/bakerydemo/templates/base.html b/bakerydemo/templates/base.html index 174aa37..3557e6f 100755 --- a/bakerydemo/templates/base.html +++ b/bakerydemo/templates/base.html @@ -32,6 +32,8 @@ {# #} + + @@ -90,15 +92,8 @@ {% endblock %} -
-
-
-
- {% block content %} - {% endblock %} -
-
-
+ {% block content %} + {% endblock %}

diff --git a/bakerydemo/templates/blocks/intro_block.htm b/bakerydemo/templates/blocks/intro_block.htm new file mode 100644 index 0000000..8c1e4a7 --- /dev/null +++ b/bakerydemo/templates/blocks/intro_block.htm @@ -0,0 +1 @@ +intro_block.html \ No newline at end of file diff --git a/bakerydemo/templates/blog/blog_page.html b/bakerydemo/templates/blog/blog_page.html index 19d1ada..beb84e2 100644 --- a/bakerydemo/templates/blog/blog_page.html +++ b/bakerydemo/templates/blog/blog_page.html @@ -2,20 +2,18 @@ {% load wagtailimages_tags %} {% block content %} -

{{ page.title }}

-
- {% image self.image fill-600x600 %} -
- - {% for tag in page.get_tags %} - {{ tag }} - {% endfor %} - - {{ page.date_published }} - - {% for author in page.authors %} -
  • {{ author }}
  • - {% endfor %} - - {{ page.body }} +{% image self.image fill-1920x600 as hero_img %} +
    +
    +

    {{ page.title }}

    +

    {{ page.subtitle }}

    +
    +
    +
    +
    +
    + {{ page.body }} +
    +
    +
    {% endblock content %} diff --git a/requirements.txt b/requirements.txt index 99d95f8..b1bddc5 100644 --- a/requirements.txt +++ b/requirements.txt @@ -5,6 +5,7 @@ wagtailfontawesome Pillow # Dependencies for Heroku deployment -dj-database-url==0.3.0 -whitenoise>=3.1,<4.0 -uwsgi>=2.0,<2.1 +dj-database-url==0.4.1 +whitenoise==3.2.2 +gunicorn==19.6.0 +psycopg2==2.6.2