Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
1975b1b
chore: setup django and ready for USSD implementation
peterolayinka Jun 14, 2018
b8707bf
removed python3 related script from codebase
peterolayinka Jun 14, 2018
13a4ddc
chore: started app with python2
peterolayinka Jun 14, 2018
ee1e926
chore: set base for USSD
peterolayinka Jun 14, 2018
d18a985
chore:setting up for heroku
peterolayinka Jun 14, 2018
a0ccf4b
fix: heroku build pack
peterolayinka Jun 14, 2018
7e57a3c
fix: heroku build pack error
peterolayinka Jun 14, 2018
a7ba63b
fix: heroku build pack error
peterolayinka Jun 14, 2018
4fc3e41
fix: heroku build pack error
peterolayinka Jun 14, 2018
178c763
fix: heroku build pack error
peterolayinka Jun 14, 2018
5fa621b
fix: heroku build pack error
peterolayinka Jun 14, 2018
ae6ba86
fix: heroku build pack error
peterolayinka Jun 14, 2018
5be4a8a
refactor: build pack still fails despite correct config
peterolayinka Jun 14, 2018
c1a5b7b
refactor: build pack still fails despite correct config
peterolayinka Jun 14, 2018
9300540
refactor: build pack still fails despite correct config
peterolayinka Jun 14, 2018
b1a7f7f
heroku: build now
peterolayinka Jun 15, 2018
3d8e792
.
peterolayinka Jun 15, 2018
a1010a1
.
peterolayinka Jun 15, 2018
8914d0e
.
peterolayinka Jun 15, 2018
a5a7f1a
.
peterolayinka Jun 15, 2018
29f49dd
.
peterolayinka Jun 15, 2018
3b91e07
.
peterolayinka Jun 15, 2018
a6773ae
...d
peterolayinka Jun 15, 2018
eeaf9b8
reverted back to amster branch
peterolayinka Jun 15, 2018
00c8478
reverted back to amster branch
peterolayinka Jun 15, 2018
09ffcfe
got app on heroku
peterolayinka Jun 15, 2018
dd074e9
got app on heroku
peterolayinka Jun 15, 2018
13209cd
setup app models, and working structure
peterolayinka Jun 15, 2018
1aaa28b
removed breakpoint
peterolayinka Jun 15, 2018
fc6f652
debugging app from simulator
peterolayinka Jun 15, 2018
c765c22
conclude ussd and voice app
peterolayinka Jun 15, 2018
69455ea
conclude ussd and voice app
peterolayinka Jun 15, 2018
4be7969
refactor: approval
peterolayinka Jun 15, 2018
358bd72
refactor: tuple error on heroku
peterolayinka Jun 15, 2018
49c81ba
fix: key_error on initiation
peterolayinka Jun 15, 2018
deb577b
chore: added customer authentication
peterolayinka Jun 15, 2018
e7b6cc1
chore: added customer authentication
peterolayinka Jun 15, 2018
418dd0c
corrected typos
peterolayinka Jun 15, 2018
a9ab2f0
optimized
peterolayinka Jun 15, 2018
c323238
fix: customer phone number bug
peterolayinka Jun 15, 2018
7581474
fix: removed breakpoint
peterolayinka Jun 15, 2018
89c8cf6
chore: completed...
peterolayinka Jun 16, 2018
223cee4
heroku: app failed on heroku for api specific parameter
peterolayinka Jun 16, 2018
13ef1ec
heroku: app failed on heroku for api specific parameter
peterolayinka Jun 16, 2018
eeeb9be
heroku: app failed on heroku for api specific parameter
peterolayinka Jun 16, 2018
c32b656
heroku: app failed on heroku for api specific parameter
peterolayinka Jun 16, 2018
8e37035
simulator stops sending text parameter at some point
peterolayinka Jun 16, 2018
81a7f35
simulator stops sending text parameter at some point
peterolayinka Jun 16, 2018
7b65bd4
heroku eb workers failed due to '\n' newline in the request
peterolayinka Jun 16, 2018
2c9cb4f
post data doesnt come in from simulator
peterolayinka Jun 16, 2018
942f6db
removed break points
peterolayinka Jun 16, 2018
ce29e36
refactor: modified some fields
peterolayinka Jun 16, 2018
099b1d1
app working fine
peterolayinka Jun 16, 2018
bf1d742
app working fine
peterolayinka Jun 16, 2018
fd823ff
app working fine
peterolayinka Jun 16, 2018
4071b0e
app working fine
peterolayinka Jun 16, 2018
84a0123
app working fine
peterolayinka Jun 16, 2018
b3a5489
removed environmental variables
peterolayinka Jun 16, 2018
99ba5d6
updated ignore file
peterolayinka Jun 16, 2018
f68ffbb
updated ignore file
peterolayinka Jun 16, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.pyc
*.pyc
venv
backup
*db.sqlite3
start_app.sh
1 change: 1 addition & 0 deletions Procfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
web: gunicorn config.wsgi --log-file -
21 changes: 21 additions & 0 deletions app.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"name": "Ussd App",
"description": "A barebones Python app, which can easily be deployed to Heroku.",
"image": "heroku/python",
"repository": "https://github.com/peterolayinka/USSDCodeChallenge",
"keywords": ["python", "django"],
"env": {
"SECRET_KEY": {
"description": "The secret key for the Django application.",
"generator": "secret"
}
},
"environments": {
"test": {
"scripts": {
"test-setup": "python manage.py collectstatic --noinput",
"test": "python manage.py test"
}
}
}
}
Empty file added config/__init__.py
Empty file.
121 changes: 121 additions & 0 deletions config/settings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
"""
Django settings for py_2_africaTalkingUSSD.

Generated by 'django-admin startproject' using Django 1.11.13.

For more information on this file, see
https://docs.djangoproject.com/en/1.11/topics/settings/

For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.11/ref/settings/
"""

import os

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))


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

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = os.environ.get('SECRET_KEY', 'something-secret')

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

ALLOWED_HOSTS = ['*']


# Application definition

INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'ussd_app'
]

MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]

ROOT_URLCONF = 'config.urls'

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',
],
},
},
]

WSGI_APPLICATION = 'config.wsgi.application'


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

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
}


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

AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
},
]


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

LANGUAGE_CODE = 'en-us'

TIME_ZONE = 'UTC'

USE_I18N = True

USE_L10N = True

USE_TZ = True


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

STATIC_URL = '/static/'
24 changes: 24 additions & 0 deletions config/urls.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
"""py_2_africaTalkingUSSD URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.11/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-based views
1. Add an import: from other_app.views import Home
2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home')
Including another URLconf
1. Import the include() function: from django.conf.urls import url, include
2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls'))
"""
from django.conf.urls import url
from django.contrib import admin
from ussd_app import views

urlpatterns = [
url(r'^$', views.process_ussd, name="process_ussd"),
url(r'^process-voice/$', views.process_voice, name="process_voice"),
url(r'^admin/', admin.site.urls),
]
16 changes: 16 additions & 0 deletions config/wsgi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
"""
WSGI config for py_2_africaTalkingUSSD 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/1.11/howto/deployment/wsgi/
"""

import os

from django.core.wsgi import get_wsgi_application

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings")

application = get_wsgi_application()
Binary file added db.sqlite3
Binary file not shown.
22 changes: 22 additions & 0 deletions manage.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/env python
import os
import sys

if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings")
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)
7 changes: 7 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
certifi==2018.4.16
Django==1.11.13
gunicorn==19.8.1
pipenv==2018.5.18
pytz==2018.4
virtualenv==16.0.0
virtualenv-clone==0.3.0
1 change: 1 addition & 0 deletions runtime.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
python-2.7.15
Loading