From 7dac1e7475cb7c76001fbe213a3c005b1f39eb60 Mon Sep 17 00:00:00 2001 From: Akshen Date: Wed, 19 Jul 2017 11:44:10 +0530 Subject: Migrates to 1.10 --- .gitignore | 35 ++++++++ manage.py | 18 +++- pyfoss/settings.py | 48 ++++++---- pyfoss/urls.py | 6 +- requirements.txt | 7 +- static/website/templates/page.html | 7 +- website/admin.py | 3 +- website/models.py | 2 +- website/templates/content.html | 3 - website/templates/footer.html | 0 website/templates/header.html | 0 website/templates/home.html | 0 website/templates/page.html | 154 --------------------------------- website/templates/website/content.html | 3 + website/templates/website/footer.html | 0 website/templates/website/header.html | 0 website/templates/website/home.html | 0 website/templates/website/page.html | 154 +++++++++++++++++++++++++++++++++ website/urls.py | 12 +-- website/views.py | 5 +- 20 files changed, 263 insertions(+), 194 deletions(-) create mode 100644 .gitignore delete mode 100644 website/templates/content.html delete mode 100644 website/templates/footer.html delete mode 100644 website/templates/header.html delete mode 100644 website/templates/home.html delete mode 100644 website/templates/page.html create mode 100644 website/templates/website/content.html create mode 100644 website/templates/website/footer.html create mode 100644 website/templates/website/header.html create mode 100644 website/templates/website/home.html create mode 100644 website/templates/website/page.html diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..545cd16 --- /dev/null +++ b/.gitignore @@ -0,0 +1,35 @@ +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# Distribution / packaging +.Python +*.log +develop-eggs/ +eggs/ +.eggs/ +lib/ +*.egg-info/ +.installed.cfg +*.egg +pip-log.txt +pip-delete-this-directory.txt + +# Django stuff: +*.log +local_settings.py + +# PyBuilder +target/ + +#Database +db1.sqlite3 +db2.sqlite3 + +# Django Migration files +migrations/ + +#MAC OS specific +.DS_Store + diff --git a/manage.py b/manage.py index ba18135..350f15c 100644 --- a/manage.py +++ b/manage.py @@ -5,6 +5,20 @@ import sys if __name__ == "__main__": os.environ.setdefault("DJANGO_SETTINGS_MODULE", "pyfoss.settings") - from django.core.management import execute_from_command_line - + try: + from django.core.management import execute_from_command_line + except ImportError: + # The above import may fail for some other reason. Ensure that the + # issue is really that Django is missing to avoid masking other + # exceptions on Python 2. + try: + import django + except ImportError: + raise ImportError( + "Couldn't import Django. Are you sure it's installed and " + "available on your PYTHONPATH environment variable? Did you " + "forget to activate a virtual environment?" + ) + raise execute_from_command_line(sys.argv) + diff --git a/pyfoss/settings.py b/pyfoss/settings.py index 2eae224..d676b4a 100644 --- a/pyfoss/settings.py +++ b/pyfoss/settings.py @@ -1,11 +1,14 @@ #Custom settings for pyfoss project. from os.path import * -from config import DB_NAME_DEFAULT, DB_USER_DEFAULT, DB_PASS_DEFAULT, DB_HOST_DEFAULT, DB_PORT_DEFAULT, DB_NAME_FOSSEEIN, DB_USER_FOSSEEIN, DB_PASS_FOSSEEIN, DB_HOST_FOSSEEIN, DB_PORT_FOSSEEIN +from config import ( DB_NAME_DEFAULT, DB_USER_DEFAULT, DB_PASS_DEFAULT, +DB_HOST_DEFAULT, DB_PORT_DEFAULT, DB_NAME_FOSSEEIN, DB_USER_FOSSEEIN, +DB_PASS_FOSSEEIN, DB_HOST_FOSSEEIN, DB_PORT_FOSSEEIN ) PROJECT_DIR = abspath(dirname(__file__) + '/../') PYFOSS_DIR = PROJECT_DIR + '/pyfoss/' WEBSITE_DIR = PROJECT_DIR + '/website/' +BASE_DIR = dirname(dirname(abspath(__file__))) # Django settings for pyfoss project. DEBUG = True @@ -32,19 +35,21 @@ MANAGERS = ADMINS DATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'. - 'NAME': DB_NAME_DEFAULT, # Or path to database file if using sqlite3. + 'NAME': DB_NAME_DEFAULT, 'USER': DB_USER_DEFAULT, 'PASSWORD': DB_PASS_DEFAULT, - 'HOST': DB_HOST_DEFAULT, # Empty for localhost through domain sockets or '127.0.0.1' for localhost through TCP. - 'PORT': DB_PORT_DEFAULT, # Set to empty string for default. + 'HOST': DB_HOST_DEFAULT, + 'PORT': DB_PORT_DEFAULT, # Or path to database file if using sqlite3. + # Set to empty string for default. }, 'fossee_in': { 'ENGINE': 'django.db.backends.mysql', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'. - 'NAME': DB_NAME_FOSSEEIN, # Or path to database file if using sqlite3. + 'NAME': DB_NAME_FOSSEEIN, 'USER': DB_USER_FOSSEEIN, 'PASSWORD': DB_PASS_FOSSEEIN, - 'HOST': DB_HOST_FOSSEEIN, # Empty for localhost through domain sockets or '127.0.0.1' for localhost through TCP. - 'PORT': DB_PORT_FOSSEEIN, # Set to empty string for default. + 'HOST': DB_HOST_FOSSEEIN, + 'PORT': DB_PORT_FOSSEEIN,# Or path to database file if using sqlite3 + # Set to empty string for default. } } @@ -108,18 +113,31 @@ STATICFILES_DIRS = ( STATICFILES_FINDERS = ( 'django.contrib.staticfiles.finders.FileSystemFinder', 'django.contrib.staticfiles.finders.AppDirectoriesFinder', -# 'django.contrib.staticfiles.finders.DefaultStorageFinder', + 'django.contrib.staticfiles.finders.DefaultStorageFinder', ) # Make this unique, and don't share it with anybody. SECRET_KEY = '8c8tb3=y%+0_ax+uyu%v*t#ly8&5=h78qwx1&15a0c59!x5a4f' # List of callables that know how to import templates from various sources. -TEMPLATE_LOADERS = ( - 'django.template.loaders.filesystem.Loader', - 'django.template.loaders.app_directories.Loader', -# 'django.template.loaders.eggs.Loader', -) + + +TEMPLATES = [ + { + 'BACKEND': 'django.template.backends.django.DjangoTemplates', + 'DIRS': [], + 'APP_DIRS': True, + 'OPTIONS': { + 'context_processors': [ + 'django.template.context_processors.debug', + 'django.template.context_processors.request', + 'django.contrib.auth.context_processors.auth', + 'django.contrib.messages.context_processors.messages', + ], + }, + }, +] + MIDDLEWARE_CLASSES = ( 'django.middleware.common.CommonMiddleware', @@ -128,7 +146,7 @@ MIDDLEWARE_CLASSES = ( 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', # Uncomment the next line for simple clickjacking protection: - # 'django.middleware.clickjacking.XFrameOptionsMiddleware', + 'django.middleware.clickjacking.XFrameOptionsMiddleware', ) ROOT_URLCONF = 'pyfoss.urls' @@ -150,7 +168,7 @@ INSTALLED_APPS = ( 'django.contrib.sites', 'django.contrib.messages', 'django.contrib.staticfiles', - 'nested_inlines', + 'nested_inline', # Uncomment the next line to enable the admin: 'django.contrib.admin', # Uncomment the next line to enable admin documentation: diff --git a/pyfoss/urls.py b/pyfoss/urls.py index ad08d4a..9779a3c 100644 --- a/pyfoss/urls.py +++ b/pyfoss/urls.py @@ -1,10 +1,10 @@ -from django.conf.urls import patterns, include, url +from django.conf.urls import include, url # Uncomment the next two lines to enable the admin: from django.contrib import admin admin.autodiscover() -urlpatterns = patterns('', +urlpatterns = [ # Uncomment the next line to enable the admin: url(r'^admin/', include(admin.site.urls)), # Uncomment the admin/doc line below to enable admin documentation: @@ -14,4 +14,4 @@ urlpatterns = patterns('', # url(r'^$', 'pyfoss.views.home', name='home'), # url(r'^pyfoss/', include('pyfoss.foo.urls')), url(r'^', include('website.urls', namespace='website')), -) +] diff --git a/requirements.txt b/requirements.txt index a45fea0..8fe6457 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,4 @@ -Django==1.5 -MySQL-python==1.2.5 -django-nested-inlines==0.1 +configparser==3.5.0 +Django==1.10 +django-nested-inline==0.3.7 +mysqlclient==1.3.10 diff --git a/static/website/templates/page.html b/static/website/templates/page.html index f9f3eb0..7e44ee5 100644 --- a/static/website/templates/page.html +++ b/static/website/templates/page.html @@ -122,11 +122,11 @@
-