Skip to content

Commit 9299922

Browse files
committed
updates18022019:12am
1 parent 9293817 commit 9299922

19 files changed

+185
-149
lines changed

.hgignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
syntax: glob
2+
*.pyc
3+
*.pyo
4+
*.db
5+
.DS_Store
6+
.coverage
7+
local_settings.py
8+
9+
syntax: regexp
10+
^static/

deploy/crontab.template

100755100644
File mode changed.

deploy/gunicorn.conf.py.template

100755100644
File mode changed.

deploy/local_settings.py.template

100755100644
File mode changed.

deploy/nginx.conf.template

100755100644
File mode changed.

deploy/supervisor.conf.template

100755100644
File mode changed.

fabfile.py

100755100644
Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,8 @@
7171
env.secret_key = conf.get("SECRET_KEY", "")
7272
env.nevercache_key = conf.get("NEVERCACHE_KEY", "")
7373

74-
if not env.secret_key:
74+
if not env.secret_key and \
75+
os.environ.get("DJANGO_SETTINGS_MODULE", "") != "docs_settings":
7576
print("Aborting, no SECRET_KEY setting defined.")
7677
exit()
7778

@@ -95,7 +96,7 @@
9596
"nginx": {
9697
"local_path": "deploy/nginx.conf.template",
9798
"remote_path": "/etc/nginx/sites-enabled/%(proj_name)s.conf",
98-
"reload_command": "service nginx restart",
99+
"reload_command": "nginx -t && service nginx restart",
99100
},
100101
"supervisor": {
101102
"local_path": "deploy/supervisor.conf.template",
@@ -444,6 +445,7 @@ def install():
444445
sudo("apt-get update -y -q")
445446
apt("nginx libjpeg-dev python-dev python-setuptools git-core "
446447
"postgresql libpq-dev memcached supervisor python-pip")
448+
apt('gcc rsync')
447449
run("mkdir -p /home/%s/logs" % env.user)
448450

449451
# Install Python requirements

manage.py

100755100644
File mode changed.

pyghana/__init__.py

100755100644
File mode changed.

pyghana/settings.py

100755100644
Lines changed: 115 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,93 @@
66
from django.utils.translation import ugettext_lazy as _
77
from .secrets import *
88

9+
######################
10+
# MEZZANINE SETTINGS #
11+
######################
12+
13+
# The following settings are already defined with default values in
14+
# the ``defaults.py`` module within each of Mezzanine's apps, but are
15+
# common enough to be put here, commented out, for conveniently
16+
# overriding. Please consult the settings documentation for a full list
17+
# of settings Mezzanine implements:
18+
# http://mezzanine.jupo.org/docs/configuration.html#default-settings
19+
20+
# Controls the ordering and grouping of the admin menu.
21+
#
22+
# ADMIN_MENU_ORDER = (
23+
# ("Content", ("pages.Page", "blog.BlogPost",
24+
# "generic.ThreadedComment", (_("Media Library"), "media-library"),)),
25+
# ("Site", ("sites.Site", "redirects.Redirect", "conf.Setting")),
26+
# ("Users", ("auth.User", "auth.Group",)),
27+
# )
28+
29+
# A three item sequence, each containing a sequence of template tags
30+
# used to render the admin dashboard.
31+
#
32+
# DASHBOARD_TAGS = (
33+
# ("blog_tags.quick_blog", "mezzanine_tags.app_list"),
34+
# ("comment_tags.recent_comments",),
35+
# ("mezzanine_tags.recent_actions",),
36+
# )
37+
38+
# A sequence of templates used by the ``page_menu`` template tag. Each
39+
# item in the sequence is a three item sequence, containing a unique ID
40+
# for the template, a label for the template, and the template path.
41+
# These templates are then available for selection when editing which
42+
# menus a page should appear in. Note that if a menu template is used
43+
# that doesn't appear in this setting, all pages will appear in it.
44+
45+
# PAGE_MENU_TEMPLATES = (
46+
# (1, _("Top navigation bar"), "pages/menus/dropdown.html"),
47+
# (2, _("Left-hand tree"), "pages/menus/tree.html"),
48+
# (3, _("Footer"), "pages/menus/footer.html"),
49+
# )
50+
51+
# A sequence of fields that will be injected into Mezzanine's (or any
52+
# library's) models. Each item in the sequence is a four item sequence.
53+
# The first two items are the dotted path to the model and its field
54+
# name to be added, and the dotted path to the field class to use for
55+
# the field. The third and fourth items are a sequence of positional
56+
# args and a dictionary of keyword args, to use when creating the
57+
# field instance. When specifying the field class, the path
58+
# ``django.models.db.`` can be omitted for regular Django model fields.
59+
#
60+
# EXTRA_MODEL_FIELDS = (
61+
# (
62+
# # Dotted path to field.
63+
# "mezzanine.blog.models.BlogPost.image",
64+
# # Dotted path to field class.
65+
# "somelib.fields.ImageField",
66+
# # Positional args for field class.
67+
# (_("Image"),),
68+
# # Keyword args for field class.
69+
# {"blank": True, "upload_to": "blog"},
70+
# ),
71+
# # Example of adding a field to *all* of Mezzanine's content types:
72+
# (
73+
# "mezzanine.pages.models.Page.another_field",
74+
# "IntegerField", # 'django.db.models.' is implied if path is omitted.
75+
# (_("Another name"),),
76+
# {"blank": True, "default": 1},
77+
# ),
78+
# )
79+
80+
# Setting to turn on featured images for blog posts. Defaults to False.
81+
#
82+
# BLOG_USE_FEATURED_IMAGE = True
983

1084
# If True, the django-modeltranslation will be added to the
1185
# INSTALLED_APPS setting.
1286
USE_MODELTRANSLATION = False
1387

14-
BLOG_USE_FEATURED_IMAGE = True
15-
BLOG_USE_LIKE = True
16-
17-
18-
ADMIN_HEADER_TITLE = 'Python Ghana'
19-
GRAPPELLI_ADMIN_TITLE = 'PYTHON GHANA (PyGhana)'
2088

2189
########################
2290
# MAIN DJANGO SETTINGS #
2391
########################
2492

2593
# Hosts/domain names that are valid for this site; required if DEBUG is False
2694
# See https://docs.djangoproject.com/en/dev/ref/settings/#allowed-hosts
27-
ALLOWED_HOSTS = ['*']
95+
ALLOWED_HOSTS = ["*"]
2896

2997
# Local time zone for this installation. Choices can be found here:
3098
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
@@ -33,7 +101,7 @@
33101
# timezone as the operating system.
34102
# If running in a Windows environment this must be set to the same as your
35103
# system time zone.
36-
TIME_ZONE = 'UTC'
104+
TIME_ZONE = 'Africa/Accra'
37105

38106
# If you set this to True, Django will use timezone-aware datetimes.
39107
USE_TZ = True
@@ -50,16 +118,13 @@
50118
# A boolean that turns on/off debug mode. When set to ``True``, stack traces
51119
# are displayed for error pages. Should always be set to ``False`` in
52120
# production. Best set to ``True`` in local_settings.py
53-
DEBUG = True
121+
DEBUG = False
54122

55123
# Whether a user's session cookie expires when the Web browser is closed.
56124
SESSION_EXPIRE_AT_BROWSER_CLOSE = True
57125

58126
SITE_ID = 1
59127

60-
61-
ANONYMOUS_USER_ID = -1
62-
63128
# If you set this to False, Django will make some optimizations so as not
64129
# to load the internationalization machinery.
65130
USE_I18N = False
@@ -71,20 +136,26 @@
71136
FILE_UPLOAD_PERMISSIONS = 0o644
72137

73138

74-
75-
76-
77-
78-
####################################################################################################################################
79139
#############
80140
# DATABASES #
81141
#############
82-
#DON'T FORGET TO REMOVE THE # SIGNS BELOW TO ACTIVATE THE DATABASE <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
83-
84-
# check local_settings.py
85-
86-
###################################################################################################################################
87142

143+
DATABASES = {
144+
"default": {
145+
# Add "postgresql_psycopg2", "mysql", "sqlite3" or "oracle".
146+
"ENGINE": "django.db.backends.",
147+
# DB name or path to database file if using sqlite3.
148+
"NAME": "",
149+
# Not used with sqlite3.
150+
"USER": "",
151+
# Not used with sqlite3.
152+
"PASSWORD": "",
153+
# Set to empty string for localhost. Not used with sqlite3.
154+
"HOST": "",
155+
# Set to empty string for default. Not used with sqlite3.
156+
"PORT": "",
157+
}
158+
}
88159

89160

90161
#########
@@ -111,16 +182,6 @@
111182
# Example: "/home/media/media.lawrence.com/static/"
112183
STATIC_ROOT = os.path.join(PROJECT_ROOT, STATIC_URL.strip("/"))
113184

114-
115-
# List of finder classes that know how to find static files in
116-
# various locations.
117-
STATICFILES_FINDERS = (
118-
'django.contrib.staticfiles.finders.FileSystemFinder',
119-
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
120-
'djangobower.finders.BowerFinder',
121-
)
122-
123-
124185
# URL that handles the media served from MEDIA_ROOT. Make sure to use a
125186
# trailing slash.
126187
# Examples: "http://media.lawrence.com/media/", "http://example.com/media/"
@@ -139,7 +200,6 @@
139200
"DIRS": [
140201
os.path.join(PROJECT_ROOT, "templates")
141202
],
142-
"APP_DIRS": True,
143203
"OPTIONS": {
144204
"context_processors": [
145205
"django.contrib.auth.context_processors.auth",
@@ -156,6 +216,11 @@
156216
"builtins": [
157217
"mezzanine.template.loader_tags",
158218
],
219+
"loaders": [
220+
"mezzanine.template.loaders.host_themes.Loader",
221+
"django.template.loaders.filesystem.Loader",
222+
"django.template.loaders.app_directories.Loader",
223+
]
159224
},
160225
},
161226
]
@@ -164,18 +229,12 @@
164229
del TEMPLATES[0]["OPTIONS"]["builtins"]
165230

166231

167-
168-
# Setting to turn on featured images for blog posts. Defaults to False.
169-
#
170-
171-
172-
FORMS_USE_HTML5 = True
173232
################
174233
# APPLICATIONS #
175234
################
176235

177236
INSTALLED_APPS = (
178-
'django.contrib.messages',
237+
'django.contrib.messages',
179238
'django.contrib.humanize',
180239
"django.contrib.admin",
181240
"django.contrib.auth",
@@ -208,13 +267,12 @@
208267
"home",
209268
'djangobower',
210269
"events",
211-
212270
)
213271

214272
# List of middleware classes to use. Order is important; in the request phase,
215273
# these middleware classes will be applied in the order given, and in the
216274
# response phase the middleware will be applied in reverse order.
217-
MIDDLEWARE_CLASSES = (
275+
MIDDLEWARE = (
218276
"mezzanine.core.middleware.UpdateCacheMiddleware",
219277

220278
'django.contrib.sessions.middleware.SessionMiddleware',
@@ -229,14 +287,17 @@
229287

230288
"mezzanine.core.request.CurrentRequestMiddleware",
231289
"mezzanine.core.middleware.RedirectFallbackMiddleware",
232-
"mezzanine.core.middleware.TemplateForDeviceMiddleware",
233-
"mezzanine.core.middleware.TemplateForHostMiddleware",
234290
"mezzanine.core.middleware.AdminLoginInterfaceSelectorMiddleware",
235291
"mezzanine.core.middleware.SitePermissionMiddleware",
236292
"mezzanine.pages.middleware.PageMiddleware",
237293
"mezzanine.core.middleware.FetchFromCacheMiddleware",
238294
)
239295

296+
if DJANGO_VERSION < (1, 10):
297+
MIDDLEWARE_CLASSES = MIDDLEWARE
298+
del MIDDLEWARE
299+
300+
240301
# Store these package names here as they may change in the future since
241302
# at the moment we are using custom forks of them.
242303
PACKAGE_NAME_FILEBROWSER = "filebrowser_safe"
@@ -246,24 +307,24 @@
246307
# OPTIONAL APPLICATIONS #
247308
#########################
248309

249-
BOWER_COMPONENTS_ROOT = '/PROJECT_ROOT/components/'
250-
251-
BOWER_INSTALLED_APPS = (
252-
'jquery',
253-
'jquery-ui',
254-
'bootstrap',
255-
'fullcalendar'
256-
)
257-
258-
259310
# These will be added to ``INSTALLED_APPS``, only if available.
260311
OPTIONAL_APPS = (
312+
"debug_toolbar",
261313
"django_extensions",
262314
"compressor",
263315
PACKAGE_NAME_FILEBROWSER,
264316
PACKAGE_NAME_GRAPPELLI,
265317
)
266318

319+
320+
BOWER_COMPONENTS_ROOT = '/PROJECT_ROOT/components/'
321+
322+
BOWER_INSTALLED_APPS = (
323+
'jquery',
324+
'jquery-ui',
325+
'bootstrap',
326+
'fullcalendar'
327+
)
267328
##################
268329
# LOCAL SETTINGS #
269330
##################
@@ -287,11 +348,6 @@
287348
exec(open(f, "rb").read())
288349

289350

290-
291-
292-
293-
294-
295351
####################
296352
# DYNAMIC SETTINGS #
297353
####################

pyghana/urls.py

100755100644
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,15 @@
88
from mezzanine.core.views import direct_to_template
99
from mezzanine.conf import settings
1010

11+
# Uncomment to use blog as home page. See also urlpatterns section below.
12+
# from mezzanine.blog import views as blog_views
1113

1214
admin.autodiscover()
1315

16+
# Add the urlpatterns for any custom Django applications here.
17+
# You can also change the ``home`` view to add your own functionality
18+
# to the project's homepage.
19+
1420
urlpatterns = i18n_patterns(
1521
# Change the admin prefix here to use an alternate URL for the
1622
# admin interface, which would be marginally more secure.
@@ -23,6 +29,15 @@
2329
]
2430

2531
urlpatterns += [
32+
# We don't want to presume how your homepage works, so here are a
33+
# few patterns you can use to set it up.
34+
35+
# HOMEPAGE AS STATIC TEMPLATE
36+
# ---------------------------
37+
# This pattern simply loads the index.html template. It isn't
38+
# commented out like the others, so it's the default. You only need
39+
# one homepage pattern, so if you use a different one, comment this
40+
# one out.
2641

2742
url("^$", direct_to_template, {"template": "index.html"}, name="home"),
2843
#url('^faq/', include('faq.urls')),
@@ -54,6 +69,8 @@
5469

5570

5671
url("^", include("mezzanine.urls")),
72+
73+
5774
]
5875

5976
# Adds ``STATIC_URL`` to the context of error pages, so that error

pyghana/wsgi.py

100755100644
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
It exposes the WSGI callable as a module-level variable named ``application``.
55
66
For more information on this file, see
7-
https://docs.djangoproject.com/en/1.10/howto/deployment/wsgi/
7+
https://docs.djangoproject.com/en/1.11/howto/deployment/wsgi/
88
"""
99

1010
import os

0 commit comments

Comments
 (0)