Cleaned up proj directory by removing extra proj dir, updated defenses, effects, and main page with new formatting for better appearance

This commit is contained in:
Michael Roy
2024-05-19 02:33:30 -04:00
parent b422b98123
commit 844ed6736c
34 changed files with 135 additions and 115 deletions

View File

@@ -1,6 +0,0 @@
SECRET_KEY=<"Your Django Secret Key">
SENTRY_API_KEY=<"Your NASA Sentry API Key">
OPENAI_API_KEY=<"Your OpenAI API Key">
HOST_CLIENT=<"Your FrontEnd URL">
ALLOWED_HOSTS=<"Your Server URL">
DEBUG=<"True for Deployment | False for Development">

View File

@@ -1,2 +0,0 @@
.env
.venv

View File

@@ -1,3 +0,0 @@
from django.contrib import admin
# Register your models here.

View File

@@ -1,6 +0,0 @@
from django.apps import AppConfig
class ApiAppConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'api_app'

View File

@@ -1,3 +0,0 @@
from django.db import models
# Create your models here.

View File

@@ -1,3 +0,0 @@
from django.test import TestCase
# Create your tests here.

View File

@@ -1,9 +0,0 @@
from django.urls import path
from .views import Sentry, OpenAI
urlpatterns = [
path('sentry/', Sentry.as_view(), name='sentry'),
path('openai/', OpenAI.as_view(), name='openai'),
]

View File

@@ -1,23 +0,0 @@
from django.core.exceptions import ValidationError
import os
import requests
from rest_framework.response import Response
from rest_framework.status import (
HTTP_200_OK,
HTTP_204_NO_CONTENT,
HTTP_201_CREATED,
HTTP_400_BAD_REQUEST
)
sentry_api_key = os.environ.get("SENTRY_API_KEY")
def get_sentry():
try:
response = requests.get(f'https://api.nasa.gov/neo/rest/v1/neo/browse?api_key={sentry_api_key}')
response.raise_for_status()
data = response.json()
return Response(data, status=HTTP_200_OK)
except ValidationError as e:
print(e)
return Response(e, status=HTTP_400_BAD_REQUEST)

View File

@@ -1,26 +0,0 @@
from django.shortcuts import render
from django.core.exceptions import ValidationError
import os
import requests
from rest_framework.views import APIView
from rest_framework.response import Response
from rest_framework.status import (
HTTP_200_OK,
HTTP_204_NO_CONTENT,
HTTP_201_CREATED,
HTTP_400_BAD_REQUEST
)
from .utils import get_sentry
sentry_api_key = os.environ.get("SENTRY_API_KEY")
# Create your views here.
class Sentry(APIView):
def get(self, request):
return get_sentry()
class OpenAI(APIView):
pass

Binary file not shown.

View File

@@ -1,22 +0,0 @@
#!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys
def main():
"""Run administrative tasks."""
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'deep_impact_proj.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)
if __name__ == '__main__':
main()

View File

@@ -1,17 +0,0 @@
asgiref==3.8.1
certifi==2024.2.2
charset-normalizer==3.3.2
click==8.1.7
Django==5.0.6
django-cors-headers==4.2.0
djangorestframework==3.15.1
gunicorn==22.0.0
h11==0.14.0
idna==3.7
packaging==24.0
python-dotenv==1.0.1
requests==2.31.0
sqlparse==0.5.0
urllib3==2.2.1
uvicorn==0.29.0
whitenoise==6.6.0