From e7de4008ef8798bd57b682080dd26cea10f6059f Mon Sep 17 00:00:00 2001 From: Timo Tomasini Date: Sat, 19 Mar 2016 13:54:19 +0100 Subject: [PATCH] some changes for apache2 deployment --- .gitignore | 1 + README.md | 7 ++++--- apache2/httpd.conf | 21 +++++++++++++++++++ manage.py | 1 + tkupek_elearning/elearning/exampledata.txt~ | 3 --- tkupek_elearning/elearning/static/admin | 1 + .../elearning/static/django_tinymce | 1 + .../elearning/static/js/elearning.js | 1 + tkupek_elearning/elearning/static/tiny_mce | 1 + tkupek_elearning/settings.py | 13 +++++------- tkupek_elearning/urls.py | 3 ++- tkupek_elearning/wsgi.py | 1 + 12 files changed, 39 insertions(+), 15 deletions(-) create mode 100644 apache2/httpd.conf delete mode 100644 tkupek_elearning/elearning/exampledata.txt~ create mode 120000 tkupek_elearning/elearning/static/admin create mode 120000 tkupek_elearning/elearning/static/django_tinymce create mode 120000 tkupek_elearning/elearning/static/tiny_mce diff --git a/.gitignore b/.gitignore index 7d44098..47a241f 100644 --- a/.gitignore +++ b/.gitignore @@ -57,3 +57,4 @@ docs/_build/ # PyBuilder target/ + diff --git a/README.md b/README.md index 54b6b09..19273a8 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,8 @@ a pragmatic and simple elearning webapp based on python django requirements: -- python -- django +- python 2.7 +- django 1.9 - sqlite3 -- tinymce \ No newline at end of file +- tinymce 2.3 + diff --git a/apache2/httpd.conf b/apache2/httpd.conf new file mode 100644 index 0000000..9f9348a --- /dev/null +++ b/apache2/httpd.conf @@ -0,0 +1,21 @@ +WSGIScriptAlias / /var/www/tkupek_elearning/wsgi.py +WSGIDaemonProcess elearning user=apache group=nobody processes=10 threads=1 +WSGIProcessGroup elearning + +Alias /static/ /var/www/tkupek_elearning/elearning/static/ + + + Order allow,deny + Allow from all + + + + + Options +FollowSymLinks + + + Order allow,deny + Allow from all + + + diff --git a/manage.py b/manage.py index 6870008..4770c10 100755 --- a/manage.py +++ b/manage.py @@ -8,3 +8,4 @@ if __name__ == "__main__": from django.core.management import execute_from_command_line execute_from_command_line(sys.argv) + diff --git a/tkupek_elearning/elearning/exampledata.txt~ b/tkupek_elearning/elearning/exampledata.txt~ deleted file mode 100644 index 7ce503c..0000000 --- a/tkupek_elearning/elearning/exampledata.txt~ +++ /dev/null @@ -1,3 +0,0 @@ -from django.test import TestCase - -# Create your tests here. diff --git a/tkupek_elearning/elearning/static/admin b/tkupek_elearning/elearning/static/admin new file mode 120000 index 0000000..3d9095c --- /dev/null +++ b/tkupek_elearning/elearning/static/admin @@ -0,0 +1 @@ +/usr/local/lib/python2.7/dist-packages/django/contrib/admin/static/admin/ \ No newline at end of file diff --git a/tkupek_elearning/elearning/static/django_tinymce b/tkupek_elearning/elearning/static/django_tinymce new file mode 120000 index 0000000..8b56daa --- /dev/null +++ b/tkupek_elearning/elearning/static/django_tinymce @@ -0,0 +1 @@ +/usr/local/lib/python2.7/dist-packages/tinymce/static/django_tinymce/ \ No newline at end of file diff --git a/tkupek_elearning/elearning/static/js/elearning.js b/tkupek_elearning/elearning/static/js/elearning.js index 58eeaa3..bf317de 100644 --- a/tkupek_elearning/elearning/static/js/elearning.js +++ b/tkupek_elearning/elearning/static/js/elearning.js @@ -207,3 +207,4 @@ function ajaxRequest() { else return false } + diff --git a/tkupek_elearning/elearning/static/tiny_mce b/tkupek_elearning/elearning/static/tiny_mce new file mode 120000 index 0000000..07ed75c --- /dev/null +++ b/tkupek_elearning/elearning/static/tiny_mce @@ -0,0 +1 @@ +/usr/local/lib/python2.7/dist-packages/tinymce/static/tiny_mce/ \ No newline at end of file diff --git a/tkupek_elearning/settings.py b/tkupek_elearning/settings.py index bb86b4a..47c0eb0 100644 --- a/tkupek_elearning/settings.py +++ b/tkupek_elearning/settings.py @@ -23,13 +23,12 @@ BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) SECRET_KEY = '_*hrxgzo(8hkrp5f8n4j9vo15acsy0b88yiy$6d5ezwi&pns(j' # SECURITY WARNING: don't run with debug turned on in production! -DEBUG = False +DEBUG = True ALLOWED_HOSTS = ["127.0.0.1", "localhost"] # Application definition - INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', @@ -42,12 +41,12 @@ INSTALLED_APPS = [ ] MIDDLEWARE_CLASSES = [ - 'django.middleware.security.SecurityMiddleware', +# 'django.middleware.security.SecurityMiddleware', +# 'django.contrib.auth.middleware.SessionAuthenticationMiddleware', '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', ] @@ -75,7 +74,6 @@ WSGI_APPLICATION = 'tkupek_elearning.wsgi.application' # Database # https://docs.djangoproject.com/en/1.9/ref/settings/#databases - DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', @@ -86,7 +84,6 @@ DATABASES = { # Password validation # https://docs.djangoproject.com/en/1.9/ref/settings/#auth-password-validators - AUTH_PASSWORD_VALIDATORS = [ { 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', @@ -105,7 +102,6 @@ AUTH_PASSWORD_VALIDATORS = [ # Internationalization # https://docs.djangoproject.com/en/1.9/topics/i18n/ - LANGUAGE_CODE = 'en-us' TIME_ZONE = 'UTC' @@ -119,5 +115,6 @@ USE_TZ = True # Static files (CSS, JavaScript, Images) # https://docs.djangoproject.com/en/1.9/howto/static-files/ - STATIC_URL = '/static/' +STATIC_ROOT = '/var/www/tkupek_elearning/elearning/static/' + diff --git a/tkupek_elearning/urls.py b/tkupek_elearning/urls.py index 61d027b..9efd0bf 100644 --- a/tkupek_elearning/urls.py +++ b/tkupek_elearning/urls.py @@ -25,4 +25,5 @@ urlpatterns = [ url(r'api', tkupek_elearning.elearning.views.get_answer), url(r'statistic', tkupek_elearning.elearning.views.statistic), url(r'^tinymce/', include('tinymce.urls')), -] \ No newline at end of file +] + diff --git a/tkupek_elearning/wsgi.py b/tkupek_elearning/wsgi.py index 0b5400c..28d4ea9 100644 --- a/tkupek_elearning/wsgi.py +++ b/tkupek_elearning/wsgi.py @@ -19,3 +19,4 @@ sys.path.append(base_parent) os.environ["DJANGO_SETTINGS_MODULE"] = "tkupek_elearning.settings" application = get_wsgi_application() +