Skip to content

Commit

Permalink
Revert "Merge pull request sclorg#150 from frenzymadness/update"
Browse files Browse the repository at this point in the history
This reverts commit bd5e352, reversing
changes made to 97c98a0.
  • Loading branch information
gabemontero committed Jul 9, 2020
1 parent bd5e352 commit 100bd17
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 63 deletions.
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

This is a [Django](http://www.djangoproject.com) project that you can use as the starting point to develop your own and deploy it on an [OpenShift](https://github.com/openshift/origin) cluster.

**NOTE:** The current master branch works with Django 2.2 LTS. The version for older Django 1.11 LTS is in [branch 1.11.x](https://github.com/sclorg/django-ex/tree/1.11.x).

The steps in this document assume that you have access to an OpenShift deployment that you can deploy applications on.

## What has been done for you
Expand Down Expand Up @@ -54,7 +52,10 @@ To run this project in your development machine, follow these steps:

1. (optional) Create and activate a [virtualenv](https://virtualenv.pypa.io/) (you may want to use [virtualenvwrapper](http://virtualenvwrapper.readthedocs.org/)).

2. Ensure that the executable `pg_config` is available on your machine. You can check this using `which pg_config`. Otherwise, sqlite will be used.
2. Ensure that the executable `pg_config` is available on your machine. You can check this using `which pg_config`. If not, install the dependency with one of the following.
- macOS: `brew install postgresql` using [Homebrew](https://brew.sh/)
- Ubuntu: `sudo apt-get install libpq-dev`
- [Others](https://stackoverflow.com/a/12037133/8122577)

3. Fork this repo and clone your fork:

Expand Down Expand Up @@ -119,8 +120,8 @@ Templates give you full control of each component of your application.
Sometimes your application is simple enough and you don't want to bother with templates. In that case, you can let OpenShift inspect your source code and create the required components automatically for you:

```bash
$ oc new-app centos/python-36-centos7~https://github.com/sclorg/django-ex
imageStreams/python-36-centos7
$ oc new-app centos/python-35-centos7~https://github.com/sclorg/django-ex
imageStreams/python-35-centos7
imageStreams/django-ex
buildConfigs/django-ex
deploymentConfigs/django-ex
Expand Down
19 changes: 4 additions & 15 deletions manage.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,10 @@
#!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys

if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "project.settings")

def main():
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'project.settings')
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
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?"
) from exc
execute_from_command_line(sys.argv)

from django.core.management import execute_from_command_line

if __name__ == '__main__':
main()
execute_from_command_line(sys.argv)
18 changes: 9 additions & 9 deletions project/settings.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
"""
Django settings for this project.
Generated by 'django-admin startproject' using Django 2.2.12.
Generated by 'django-admin startproject' using Django 1.11.6.
For more information on this file, see
https://docs.djangoproject.com/en/2.2/topics/settings/
https://docs.djangoproject.com/en/1.11/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.2/ref/settings/
https://docs.djangoproject.com/en/1.11/ref/settings/
"""

import os
Expand All @@ -17,7 +17,7 @@


# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/2.2/howto/deployment/checklist/
# See https://docs.djangoproject.com/en/1.11/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
# The SECRET_KEY is provided via an environment variable in OpenShift
Expand Down Expand Up @@ -76,11 +76,11 @@
},
]

WSGI_APPLICATION = 'project.wsgi.application'
WSGI_APPLICATION = 'wsgi.application'


# Database
# https://docs.djangoproject.com/en/2.2/ref/settings/#databases
# https://docs.djangoproject.com/en/1.11/ref/settings/#databases

from . import database

Expand All @@ -90,7 +90,7 @@


# Password validation
# https://docs.djangoproject.com/en/2.2/ref/settings/#auth-password-validators
# https://docs.djangoproject.com/en/1.11/ref/settings/#auth-password-validators

AUTH_PASSWORD_VALIDATORS = [
{
Expand All @@ -109,7 +109,7 @@


# Internationalization
# https://docs.djangoproject.com/en/2.2/topics/i18n/
# https://docs.djangoproject.com/en/1.11/topics/i18n/

LANGUAGE_CODE = 'en-us'

Expand All @@ -123,7 +123,7 @@


# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/2.2/howto/static-files/
# https://docs.djangoproject.com/en/1.11/howto/static-files/

STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
Expand Down
29 changes: 9 additions & 20 deletions project/urls.py
Original file line number Diff line number Diff line change
@@ -1,32 +1,21 @@
"""project URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/2.2/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-based views
1. Add an import: from other_app.views import Home
2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
Including another URLconf
1. Import the include() function: from django.urls import include, path
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""
from django.conf import settings
from django.conf.urls import include, url
from django.contrib import admin
from django.urls import include, path

from welcome.views import index, health

urlpatterns = [
path('', index, name='home'),
path('health/', health),
path('admin/', admin.site.urls),
# Examples:
# url(r'^$', 'project.views.home', name='home'),
# url(r'^blog/', include('blog.urls')),

url(r'^$', index),
url(r'^health$', health),
url(r'^admin/', include(admin.site.urls)),
]

if settings.DEBUG:
import debug_toolbar
urlpatterns = [
path('__debug__/', include(debug_toolbar.urls)),
url(r'^__debug__/', include(debug_toolbar.urls)),
] + urlpatterns
10 changes: 4 additions & 6 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
Django>=2.2.12,<3.0
django-debug-toolbar==2.2
gunicorn==20.0.4
django>=1.11,<1.12
django-debug-toolbar==1.8
gunicorn==19.5.0
psycopg2==2.8.5
pytz==2020.1
sqlparse==0.3.1
whitenoise==5.1.0
whitenoise==3.3.1
5 changes: 0 additions & 5 deletions welcome/apps.py

This file was deleted.

6 changes: 3 additions & 3 deletions project/wsgi.py → wsgi.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
"""
WSGI config for this project.
WSGI config for project project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/2.2/howto/deployment/wsgi/
https://docs.djangoproject.com/en/1.11/howto/deployment/wsgi/
"""

import os

from django.core.wsgi import get_wsgi_application

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'project.settings')
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "project.settings")

application = get_wsgi_application()

0 comments on commit 100bd17

Please sign in to comment.