Просмотр исходного кода

Merge pull request #26 from wagtail/3-heroku

Clean up Heroku deploy
David Ray 8 лет назад
Родитель
Сommit
1b8f29b814
6 измененных файлов с 36 добавлено и 22 удалено
  1. 1 6
      bakerydemo/settings/heroku.py
  2. 22 4
      readme.md
  3. 1 11
      requirements.txt
  4. 5 0
      requirements/base.txt
  5. 6 0
      requirements/heroku.txt
  6. 1 1
      vagrant/provision.sh

+ 1 - 6
bakerydemo/settings/heroku.py

@@ -8,7 +8,7 @@ DEBUG = True
 # Accept all hostnames, since we don't know in advance which hostname will be used for any given Heroku instance.
 # IMPORTANT: Set this to a real hostname when using this in production!
 # See https://docs.djangoproject.com/en/1.10/ref/settings/#allowed-hosts
-ALLOWED_HOSTS = ['*', 'wagtailbakerydemo.herokuapp.com']
+ALLOWED_HOSTS = ['*', ]
 
 EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
 
@@ -22,8 +22,3 @@ DATABASES['default'].update(db_from_env)
 # https://warehouse.python.org/project/whitenoise/
 
 STATICFILES_STORAGE = 'whitenoise.django.GzipManifestStaticFilesStorage'
-
-try:
-    from .local import *
-except ImportError:
-    pass

+ 22 - 4
readme.md

@@ -1,5 +1,3 @@
-[![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy?template=https://github.com/wagtail/bakerydemo)
-
 Wagtail demo project
 =======================
 
@@ -53,7 +51,7 @@ With PIP installed run the following commands:
 
     git clone git@github.com:wagtail/bakerydemo.git
     cd wagtaildemo
-    pip install -r requirements.txt
+    pip install -r requirements/base.txt
     ./manage.py migrate
     ./manage.py load_initial_data
     ./manage.py runserver
@@ -66,4 +64,24 @@ Because we can't (easily) use ElasticSearch for this demo, we use wagtail's nati
 However, native DB search can't search specific fields in our models on a generalized `Page` query.
 So for demo purposes ONLY, we hard-code the model names we want to search into `search.views`, which is
 not ideal. In production, use ElasticSearch and a simplified search query, per
-http://docs.wagtail.io/en/v1.8.1/topics/search/searching.html
+[http://docs.wagtail.io/en/v1.8.1/topics/search/searching.html](http://docs.wagtail.io/en/v1.8.1/topics/search/searching.html).
+
+### Heroku deployment:
+
+If you need to deploy your demo site to a publicly accessible server [Heroku](https://heroku.com)
+provides a one-click deployment solution:
+
+[![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy?template=https://github.com/wagtail/bakerydemo)
+
+If you do not have a Heroku account, clicking the above button will walk you through the steps
+to generate one.  After which, you will be presented with a screen to configure your app. For our purposes,
+we will accept all of the defaults and click `Deploy`.  The status of the deployment will dynamically
+update in the browser. Once finished, click `View` to see the public site.
+
+Log into the admin with the credentials ``admin / changeme``.
+
+To learn more about Heroku, read [Deploying Python and Django Apps on Heroku](https://devcenter.heroku.com/articles/deploying-python).
+
+
+
+

+ 1 - 11
requirements.txt

@@ -1,11 +1 @@
-Django
-elasticsearch
-wagtail
-wagtailfontawesome
-Pillow
-
-# Dependencies for Heroku deployment
-dj-database-url==0.4.1
-whitenoise==3.2.2
-gunicorn==19.6.0
-psycopg2==2.6.2
+-r requirements/heroku.txt

+ 5 - 0
requirements/base.txt

@@ -0,0 +1,5 @@
+Django
+elasticsearch
+wagtail
+wagtailfontawesome
+Pillow

+ 6 - 0
requirements/heroku.txt

@@ -0,0 +1,6 @@
+-r base.txt
+# Additional dependencies for Heroku deployment
+dj-database-url
+gunicorn
+psycopg2
+whitenoise

+ 1 - 1
vagrant/provision.sh

@@ -25,7 +25,7 @@ su - vagrant -c "echo $PROJECT_DIR > $VIRTUALENV_DIR/.project"
 su - vagrant -c "$PIP install --upgrade pip"
 
 # Install PIP requirements
-su - vagrant -c "$PIP install -r $PROJECT_DIR/requirements.txt"
+su - vagrant -c "$PIP install -r $PROJECT_DIR/requirements/base.txt"
 
 
 # Set execute permissions on manage.py as they get lost if we build from a zip file