Rafał Pitoń 11 лет назад
Родитель
Сommit
557d9e7bd1

+ 1 - 0
misago/project_template/attachments/README.txt

@@ -0,0 +1 @@
+This directory is used by Misago to store uploaded posts attachments.

+ 0 - 0
misago/project_template/media/index.html


+ 45 - 12
misago/project_template/project_name/settings.py

@@ -20,9 +20,6 @@ BASE_DIR = os.path.dirname(os.path.dirname(__file__))
 # Quick-start development settings - unsuitable for production
 # See https://docs.djangoproject.com/en/{{ docs_version }}/howto/deployment/checklist/
 
-# SECURITY WARNING: keep the secret key used in production secret!
-SECRET_KEY = '{{ secret_key }}'
-
 # SECURITY WARNING: don't run with debug turned on in production!
 DEBUG = True
 
@@ -31,13 +28,6 @@ TEMPLATE_DEBUG = True
 ALLOWED_HOSTS = []
 
 
-# Application definition
-
-ROOT_URLCONF = '{{ project_name }}.urls'
-
-WSGI_APPLICATION = '{{ project_name }}.wsgi.application'
-
-
 # Database
 # https://docs.djangoproject.com/en/{{ docs_version }}/ref/settings/#databases
 
@@ -49,13 +39,56 @@ DATABASES = {
 }
 
 
-# Internationalization
+# Cache
+# https://docs.djangoproject.com/en/{{ docs_version }}/ref/settings/#caches
+
+CACHES = {{
+    'default': {
+        'BACKEND': 'django.core.cache.backends.locmem.DummyCache',
+    }
+}
+
+
+# Site language
 # https://docs.djangoproject.com/en/{{ docs_version }}/topics/i18n/
 
 LANGUAGE_CODE = 'en-us'
 
 
-# Static files (CSS, JavaScript, Images)
+# Path used to access static files (CSS, JavaScript, Images)
 # https://docs.djangoproject.com/en/{{ docs_version }}/howto/static-files/
 
 STATIC_URL = '/static/'
+
+# Path used to access uploaded media (Avatars and Profile Backgrounds, ect.)
+# This is NOT path used to serve posts attachments.
+# https://docs.djangoproject.com/en/{{ docs_version }}/howto/static-files/
+MEDIA_URL = '/media/'
+
+
+# Automatically setup default paths to media and attachments directories
+STATIC_ROOT = os.path.join(BASE_DIR, 'static')
+MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
+ATTACHMENTS_ROOT = os.path.join(BASE_DIR, 'attachments')
+
+
+# Automatically setup default paths for static and template directories
+# You can use those directories to easily customize and add your own
+# assets and templates to your site
+STATICFILES_DIRS = (
+    os.path.join(BASE_DIR, 'theme/static'),
+) + STATICFILES_DIRS
+
+TEMPLATE_DIRS = (
+    os.path.join(BASE_DIR, 'theme/templates'),
+) + TEMPLATE_DIRS
+
+
+# SECURITY WARNING: keep the secret key used in production secret!
+SECRET_KEY = '{{ secret_key }}'
+
+
+# Application definition
+# Don't edit those settings unless you know what you are doing
+ROOT_URLCONF = '{{ project_name }}.urls'
+WSGI_APPLICATION = '{{ project_name }}.wsgi.application'

+ 6 - 5
misago/project_template/project_name/urls.py

@@ -1,3 +1,4 @@
+from django.conf import settings
 from django.conf.urls import patterns, include, url
 
 from django.contrib import admin
@@ -10,6 +11,11 @@ urlpatterns = patterns('',
 )
 
 
+# Serve static and media files in development
+urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
+urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
+
+
 # Error Handlers
 # Misago needs those handlers to deal with errors raised by it's middlewares
 # If you replace those handlers with custom ones, make sure you decorate them
@@ -17,8 +23,3 @@ urlpatterns = patterns('',
 # decorators that are defined in misago.views.errorpages module!
 handler403 = 'misago.views.errorpages.permission_denied'
 handler404 = 'misago.views.errorpages.page_not_found'
-
-
-# Serve static files in development
-from django.contrib.staticfiles.urls import staticfiles_urlpatterns
-urlpatterns += staticfiles_urlpatterns()

+ 2 - 0
misago/project_template/static/README.txt

@@ -0,0 +1,2 @@
+This directory is used to gather publicly available assets like images, icons, css filers et all.
+Don't put any files here yourself, or you will risk losing them. Use themes/static instead.

+ 0 - 0
misago/project_template/static/index.html


+ 1 - 0
misago/project_template/theme/static/README.txt

@@ -0,0 +1 @@
+You can use this directory to replace default assets with custom ones or add new ones to your site. Remember to use collectstatic command with "-c" argument to make your changes visible.

+ 1 - 0
misago/project_template/theme/templates/README.txt

@@ -0,0 +1 @@
+You can use this directory to replace default templates with custom ones as well as add new ones to your theme.