Browse Source

Merge branch '2.2.x' into 2.2.x

pull/208/head
Petr Hracek 2 years ago
committed by GitHub
parent
commit
f3d5a74cde
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 11 additions and 9 deletions
  1. +3
    -3
      README.md
  2. +1
    -1
      openshift/templates/django-postgresql-persistent.json
  3. +1
    -1
      openshift/templates/django-postgresql.json
  4. +1
    -1
      openshift/templates/django.json
  5. +1
    -1
      requirements.txt
  6. +2
    -2
      welcome/templates/welcome/index.html
  7. +2
    -0
      welcome/views.py

+ 3
- 3
README.md View File

@ -2,7 +2,7 @@
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. 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:** This is the latest version of this example with Django 2.2 LTS which works with RHEL/Centos 8 only. If you are looking for the version for RHEL/Centos 7, it's in the [master branch](https://github.com/sclorg/django-ex/tree/master).
**NOTE:** This is an example Django application for specific Django LTS version. If you want an older or newer version, check the alternative branches.
The steps in this document assume that you have access to an OpenShift deployment that you can deploy applications on. The steps in this document assume that you have access to an OpenShift deployment that you can deploy applications on.
@ -56,9 +56,9 @@ To run this project in your development machine, follow these steps:
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`. Otherwise, sqlite will be used.
3. Fork this repo and clone your fork:
**Note:** pg_config is not needed. You can use sqlite instead.
`git clone https://github.com/sclorg/django-ex.git`
3. Fork this repo and clone your fork. Make sure that you are in the right branch.
4. Install dependencies: 4. Install dependencies:


+ 1
- 1
openshift/templates/django-postgresql-persistent.json View File

@ -440,7 +440,7 @@
{ {
"name": "PYTHON_VERSION", "name": "PYTHON_VERSION",
"displayName": "Version of Python Image", "displayName": "Version of Python Image",
"description": "Version of Python image to be used (3.6-ubi8, 3.8-ubi7, 3.8-ubi8, or latest).",
"description": "Version of Python image to be used (3.6-ubi8, 3.8-ubi8, or latest).",
"value": "3.8-ubi8", "value": "3.8-ubi8",
"required": true "required": true
}, },


+ 1
- 1
openshift/templates/django-postgresql.json View File

@ -421,7 +421,7 @@
{ {
"name": "PYTHON_VERSION", "name": "PYTHON_VERSION",
"displayName": "Version of Python Image", "displayName": "Version of Python Image",
"description": "Version of Python image to be used (3.6-ubi8, 3.8-ubi7, 3.8-ubi8, or latest).",
"description": "Version of Python image to be used (3.6-ubi8, 3.8-ubi8, or latest).",
"value": "3.8-ubi8", "value": "3.8-ubi8",
"required": true "required": true
}, },


+ 1
- 1
openshift/templates/django.json View File

@ -251,7 +251,7 @@
{ {
"name": "PYTHON_VERSION", "name": "PYTHON_VERSION",
"displayName": "Version of Python Image", "displayName": "Version of Python Image",
"description": "Version of Python image to be used (3.6-ubi8, 3.8-ubi7, 3.8-ubi8, or latest).",
"description": "Version of Python image to be used (3.6-ubi8, 3.8-ubi8, or latest).",
"value": "3.8-ubi8", "value": "3.8-ubi8",
"required": true "required": true
}, },


+ 1
- 1
requirements.txt View File

@ -1,7 +1,7 @@
Django>=2.2.12,<3.0 Django>=2.2.12,<3.0
django-debug-toolbar==2.2 django-debug-toolbar==2.2
gunicorn==20.0.4 gunicorn==20.0.4
psycopg2==2.8.5
psycopg2-binary==2.9.5
pytz==2020.1 pytz==2020.1
sqlparse==0.3.1 sqlparse==0.3.1
whitenoise==5.1.0 whitenoise==5.1.0

+ 2
- 2
welcome/templates/welcome/index.html View File

@ -220,7 +220,7 @@ pre {
<section class='col-xs-12 col-sm-6 col-md-6'> <section class='col-xs-12 col-sm-6 col-md-6'>
<section> <section>
<h2>How to use this example application</h2> <h2>How to use this example application</h2>
<p>For instructions on how to use this application with OpenShift, start by reading the <a href="http://docs.okd.io/latest/dev_guide/templates.html#using-the-quickstart-templates">Developer Guide</a>.</p>
<p>For instructions on how to use this application with OpenShift, start by reading the <a href="https://docs.okd.io/latest/openshift_images/using-templates.html#templates-using-instant-app-quickstart_using-templates">Developer Guide</a>.</p>
<h2>Deploying code changes</h2> <h2>Deploying code changes</h2>
<p> <p>
@ -282,7 +282,7 @@ $ git push</pre>
<h2>Managing your application</h2> <h2>Managing your application</h2>
<p>Documentation on how to manage your application from the Web Console or Command Line is available at the <a href="http://docs.okd.io/latest/dev_guide/overview.html">Developer Guide</a>.</p>
<p>Documentation on how to manage your application from the <a href="https://docs.okd.io/latest/web_console/web-console.html">Web Console</a> or <a href="https://docs.okd.io/latest/cli_reference/index.html">Command Line</a> is available at the <a href="http://docs.okd.io/latest/welcome/overview.html">OKD Documentation</a>.</p>
<h3>Web Console</h3> <h3>Web Console</h3>
<p>You can use the Web Console to view the state of your application components and launch new builds.</p> <p>You can use the Web Console to view the state of your application components and launch new builds.</p>


+ 2
- 0
welcome/views.py View File

@ -9,6 +9,7 @@ from .models import PageView
# Create your views here. # Create your views here.
def index(request): def index(request):
"""Takes an request object as a parameter and creates an pageview object then responds by rendering the index view."""
hostname = os.getenv('HOSTNAME', 'unknown') hostname = os.getenv('HOSTNAME', 'unknown')
PageView.objects.create(hostname=hostname) PageView.objects.create(hostname=hostname)
@ -19,4 +20,5 @@ def index(request):
}) })
def health(request): def health(request):
"""Takes an request as a parameter and gives the count of pageview objects as reponse"""
return HttpResponse(PageView.objects.count()) return HttpResponse(PageView.objects.count())

Loading…
Cancel
Save