organize settings, setup

main
eric 2023-03-24 13:19:19 -04:00
parent ca3c0e4fe5
commit 5defebdd88
9 changed files with 57 additions and 24 deletions

2
.gitignore vendored
View File

@ -25,6 +25,7 @@ share/python-wheels/
.installed.cfg .installed.cfg
*.egg *.egg
MANIFEST MANIFEST
keys/
# PyInstaller # PyInstaller
# Usually these files are written by a python script from a template # Usually these files are written by a python script from a template
@ -113,6 +114,7 @@ celerybeat.pid
# Environments # Environments
.env .env
.env.key
.venv .venv
env/ env/
venv/ venv/

View File

@ -0,0 +1,2 @@
from .common import *
from .local_settings import *

View File

@ -14,20 +14,10 @@ from pathlib import Path
# Build paths inside the project like this: BASE_DIR / 'subdir'. # Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent BASE_DIR = Path(__file__).resolve().parent.parent
print(BASE_DIR)
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/4.1/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'django-insecure-$@5jch%4&#^6%r0t!p#n+24mfb)+f#*=s8c7hqbn&htu&pd4ej'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
ALLOWED_HOSTS = [] ALLOWED_HOSTS = []
# Application definition # Application definition
INSTALLED_APPS = [ INSTALLED_APPS = [
@ -71,18 +61,6 @@ TEMPLATES = [
WSGI_APPLICATION = 'doab_check.wsgi.application' WSGI_APPLICATION = 'doab_check.wsgi.application'
# Database
# https://docs.djangoproject.com/en/4.1/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': 'doabcheck',
'USER': 'postgres',
'HOST': '127.0.0.1',
'PORT': '5433', }
}
# Password validation # Password validation
# https://docs.djangoproject.com/en/4.1/ref/settings/#auth-password-validators # https://docs.djangoproject.com/en/4.1/ref/settings/#auth-password-validators

View File

@ -0,0 +1,11 @@
<html>
<head>
<title>DOAB Check</title>
</head>
<body>
<h1>
Welcome to DOAB Check!
</h1>
</body>
</html>

View File

@ -2,10 +2,12 @@
""" """
from django.contrib import admin from django.contrib import admin
from django.urls import path from django.urls import path
from django.views.generic.base import TemplateView
from . import views from . import views
urlpatterns = [ urlpatterns = [
path('', TemplateView.as_view(template_name='index.html')),
path('admin/', admin.site.urls), path('admin/', admin.site.urls),
path('providers/', views.ProvidersView.as_view(), name='providers'), path('providers/', views.ProvidersView.as_view(), name='providers'),
path('providers/<str:provider>/', views.ProviderView.as_view(), name='provider'), path('providers/<str:provider>/', views.ProviderView.as_view(), name='provider'),

View File

@ -25,7 +25,7 @@ class ProviderView(generic.TemplateView):
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
prov = kwargs['provider'] prov = kwargs['provider']
provider = {'provider': prov} provider = {'provider': prov}
provider_links = Link.objects.filter(provider=prov) provider_links = Link.objects.filter(provider=prov, active=True)
provider['link_count'] = provider_links.count() provider['link_count'] = provider_links.count()
return {'provider': provider, 'links': provider_links} return {'provider': provider, 'links': provider_links}

3
pyproject.toml Normal file
View File

@ -0,0 +1,3 @@
[build-system]
requires = ['setuptools>=40.8.0', 'wheel']
build-backend = 'setuptools.build_meta:__legacy__'

32
setup.cfg Normal file
View File

@ -0,0 +1,32 @@
[metadata]
name = doab-check
version = 0.1
description = A Django app to check links at DOAB.
long_description = file: README.rst
url = https://www.example.com/
author = Your Name
author_email = yourname@example.com
license = BSD-3-Clause # Example license
classifiers =
Environment :: Web Environment
Framework :: Django
Framework :: Django :: 4.1
License :: OSI Approved :: BSD License
Operating System :: OS Independent
Programming Language :: Python
Programming Language :: Python :: 3
Programming Language :: Python :: 3 :: Only
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Topic :: Internet :: WWW/HTTP
Topic :: Internet :: WWW/HTTP :: Dynamic Content
[options]
include_package_data = true
packages = find:
python_requires = >=3.8
install_requires =
Django == 4.1.7
psycopg2 == 2.9.5
pyoai == 2.5.0
requests == 2.28.2

3
setup.py Normal file
View File

@ -0,0 +1,3 @@
from setuptools import setup
setup()