Skip to content

Commit

Permalink
Final Push
Browse files Browse the repository at this point in the history
  • Loading branch information
prettyquail committed Jan 2, 2022
1 parent 9277bfb commit 4eefc3e
Show file tree
Hide file tree
Showing 32 changed files with 157 additions and 66 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
env/
Binary file added Book2.xlsx
Binary file not shown.
Binary file added Book3.xlsx
Binary file not shown.
Binary file modified ExchangeRates/__pycache__/__init__.cpython-38.pyc
Binary file not shown.
Binary file modified ExchangeRates/__pycache__/admin.cpython-38.pyc
Binary file not shown.
Binary file added ExchangeRates/__pycache__/apps.cpython-38.pyc
Binary file not shown.
Binary file modified ExchangeRates/__pycache__/models.cpython-38.pyc
Binary file not shown.
Binary file modified ExchangeRates/__pycache__/urls.cpython-38.pyc
Binary file not shown.
Binary file modified ExchangeRates/__pycache__/views.cpython-38.pyc
Binary file not shown.
5 changes: 3 additions & 2 deletions ExchangeRates/admin.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from django.contrib import admin
from . models import Currency
from .models import Currency

# Register your models here.
admin.site.register(Currency)
admin.site.register(Currency)
2 changes: 1 addition & 1 deletion ExchangeRates/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@


class ExchangeratesConfig(AppConfig):
name = 'ExchangeRates'
name = "ExchangeRates"
21 changes: 14 additions & 7 deletions ExchangeRates/migrations/0001_initial.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,24 @@ class Migration(migrations.Migration):

initial = True

dependencies = [
]
dependencies = []

operations = [
migrations.CreateModel(
name='Currency',
name="Currency",
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('country', models.CharField(max_length=5)),
('abbrs', models.CharField(max_length=66)),
('currencies', models.CharField(max_length=55)),
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("country", models.CharField(max_length=5)),
("abbrs", models.CharField(max_length=66)),
("currencies", models.CharField(max_length=55)),
],
),
]
Binary file modified ExchangeRates/migrations/__pycache__/0001_initial.cpython-38.pyc
Binary file not shown.
Binary file modified ExchangeRates/migrations/__pycache__/__init__.cpython-38.pyc
Binary file not shown.
6 changes: 3 additions & 3 deletions ExchangeRates/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

# Create your models here.
class Currency(models.Model):
country=models.CharField(max_length=5)
abbrs=models.CharField(max_length=66)
currencies=models.CharField(max_length=55)
country = models.CharField(max_length=5)
abbrs = models.CharField(max_length=66)
currencies = models.CharField(max_length=55)
12 changes: 5 additions & 7 deletions ExchangeRates/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@
from django.urls import path

urlpatterns = [
path('',views.main,name='main'),
path('one/',views.index,name='index'),
path('two/',views.indextwo,name='indextwo'),
path('three/',views.indexthree,name='indexthree'),


]
path("", views.main, name="main"),
path("one/", views.index, name="index"),
path("two/", views.indextwo, name="indextwo"),
path("three/", views.indexthree, name="indexthree"),
]
38 changes: 38 additions & 0 deletions ExchangeRates/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,28 @@ def index(request):
i=i+1

currency_rates=pd.DataFrame({'Currency_Name':abbrs,'curr':currencies,})
localtime = time.asctime( time.localtime(time.time()) )

df= pd.read_excel("dummy.xlsx")
# print(df)

# print("Currencies",currencies)
df = df.loc[:, ~df.columns.str.contains("^Unnamed")]
df[localtime]=currencies
df.to_excel("dummy.xlsx")

df2 = pd.DataFrame(
{
localtime:currencies,
})



# df[localtime] = df2
# df.to_excel("output.xlsx")
# df1.to_csv('mydata1.csv')
# a = pd.read_csv("mydata1.csv")

return render(request,'ExchangeRates/index.html',context={'form':currency_rates})

def indextwo(request):
Expand All @@ -38,6 +60,14 @@ def indextwo(request):
i=i+1

currency_rates=pd.DataFrame({'Currency_Name':abbrs,'curr':currencies,})
df= pd.read_excel("Book2.xlsx")
print(df)

print("Currencies",currencies)
df = df.loc[:, ~df.columns.str.contains("^Unnamed")]
df[localtime]=currencies
df.to_excel("Book2.xlsx")

return render(request,'ExchangeRates/indextwo.html',context={'form':currency_rates})

def indexthree(request):
Expand All @@ -53,6 +83,14 @@ def indexthree(request):
i=i+1

currency_rates=pd.DataFrame({'Currency_Name':country,'curr':currencies,})
df= pd.read_excel("Book3.xlsx")
print(df)

print("Currencies",currencies)
df = df.loc[:, ~df.columns.str.contains("^Unnamed")]
df[localtime]=currencies
df.to_excel("Book3.xlsx")

return render(request,'ExchangeRates/indexthree.html',context={'form':currency_rates})


Expand Down
2 changes: 2 additions & 0 deletions Procfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
release: python manage.py migrate
web: gunicorn WS.wsgi --log-file=-
Binary file modified WS/__pycache__/__init__.cpython-38.pyc
Binary file not shown.
Binary file modified WS/__pycache__/settings.cpython-38.pyc
Binary file not shown.
Binary file modified WS/__pycache__/urls.cpython-38.pyc
Binary file not shown.
Binary file modified WS/__pycache__/wsgi.cpython-38.pyc
Binary file not shown.
2 changes: 1 addition & 1 deletion WS/asgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@

from django.core.asgi import get_asgi_application

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

application = get_asgi_application()
88 changes: 50 additions & 38 deletions WS/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"""

import os

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

Expand All @@ -20,64 +20,75 @@
# See https://docs.djangoproject.com/en/3.0/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'jy!uzexwo$xr8vg-h8emd07u7k4h%^!ah-w1a+3^zh*jk17ze@'
SECRET_KEY = "jy!uzexwo$xr8vg-h8emd07u7k4h%^!ah-w1a+3^zh*jk17ze@"

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

ALLOWED_HOSTS = []
ALLOWED_HOSTS = ["WS.herokuapp.com"]


# Application definition

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

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',
"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 = 'WS.urls'
ROOT_URLCONF = "WS.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',
"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 = 'WS.wsgi.application'
WSGI_APPLICATION = "WS.wsgi.application"


# Database
# https://docs.djangoproject.com/en/3.0/ref/settings/#databases
#
# DATABASES = {
# "default": {
# "ENGINE": "django.db.backends.sqlite3",
# "NAME": os.path.join(BASE_DIR, "db.sqlite3"),
# }
# }

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
"default": {
"ENGINE": "django.db.backends.postgresql_psycopg2",
"NAME": "d2unjm29v6gokp",
"USER": "tovalqbgbapfqy",
"PASSWORD": "efee8862ee737964fa253d26aca70c75c6cae1a00d0e27a83a2991f286591cdd",
"HOST": "ec2-54-204-28-187.compute-1.amazonaws.com",
"PORT": "5432",
}
}

Expand All @@ -87,26 +98,26 @@

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


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

LANGUAGE_CODE = 'en-us'
LANGUAGE_CODE = "en-us"

TIME_ZONE = 'UTC'
TIME_ZONE = "UTC"

USE_I18N = True

Expand All @@ -118,4 +129,5 @@
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/3.0/howto/static-files/

STATIC_URL = '/static/'
STATIC_URL = "/static/"
django_heroku.settings(locals())
6 changes: 3 additions & 3 deletions WS/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path,include
from django.urls import path, include

urlpatterns = [
path('admin/', admin.site.urls),
path('', include('ExchangeRates.urls')),
path("admin/", admin.site.urls),
path("", include("ExchangeRates.urls")),
]
2 changes: 1 addition & 1 deletion WS/wsgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@

from django.core.wsgi import get_wsgi_application

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

application = get_wsgi_application()
Binary file modified db.sqlite3
Binary file not shown.
Binary file added dummy.xlsx
Binary file not shown.
4 changes: 2 additions & 2 deletions manage.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@


def main():
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'WS.settings')
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "WS.settings")
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
Expand All @@ -17,5 +17,5 @@ def main():
execute_from_command_line(sys.argv)


if __name__ == '__main__':
if __name__ == "__main__":
main()
1 change: 0 additions & 1 deletion output.csv

This file was deleted.

32 changes: 32 additions & 0 deletions requirements
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
asgiref==3.4.1
backports.zoneinfo==0.2.1
beautifulsoup4==4.10.0
black==21.12b0
bs4==0.0.1
certifi==2021.10.8
charset-normalizer==2.0.9
click==8.0.3
colorama==0.4.4
dj-database-url==0.5.0
Django==4.0
django-heroku==0.3.1
et-xmlfile==1.1.0
idna==3.3
mypy-extensions==0.4.3
numpy==1.22.0
openpyxl==3.0.9
pandas==1.3.5
pathspec==0.9.0
platformdirs==2.4.1
psycopg2==2.9.3
python-dateutil==2.8.2
pytz==2021.3
requests==2.26.0
six==1.16.0
soupsieve==2.3.1
sqlparse==0.4.2
tomli==1.2.3
typing_extensions==4.0.1
tzdata==2021.5
urllib3==1.26.7
whitenoise==5.3.0
1 change: 1 addition & 0 deletions runtime
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
python-3.8.8

0 comments on commit 4eefc3e

Please sign in to comment.