Eliminate "conservancy" and "apps" subdirectories
The directory nesting is unnecessary here and confusing to navigate. I've moved all apps to the project subdirectory, currently called "www", but soon to be renamed "conservancy". I've also moved manage.py to the top-level directory.
This commit is contained in:
parent
cc3224bb60
commit
531a97a3c9
526 changed files with 76 additions and 109 deletions
19
manage.py
Executable file
19
manage.py
Executable file
|
@ -0,0 +1,19 @@
|
||||||
|
#!/usr/bin/env python
|
||||||
|
"""Django command-line utility for administration tasks.
|
||||||
|
|
||||||
|
See https://docs.djangoproject.com/en/4.0/ref/django-admin/
|
||||||
|
"""
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'www.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)
|
|
@ -2,4 +2,4 @@ from django.apps import AppConfig
|
||||||
|
|
||||||
|
|
||||||
class AssignmentConfig(AppConfig):
|
class AssignmentConfig(AppConfig):
|
||||||
name = 'conservancy.apps.assignment'
|
name = 'www.assignment'
|
|
@ -3,7 +3,7 @@ from datetime import datetime, timedelta
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.db import models
|
from django.db import models
|
||||||
|
|
||||||
from ... import bsoup
|
from .. import bsoup
|
||||||
from ..staff.models import Person
|
from ..staff.models import Person
|
||||||
|
|
||||||
|
|
|
@ -1,42 +0,0 @@
|
||||||
import hashlib
|
|
||||||
|
|
||||||
from django.conf import settings
|
|
||||||
|
|
||||||
|
|
||||||
class ParameterValidator:
|
|
||||||
def __init__(self, given_hash_or_params, params_hash_key=None):
|
|
||||||
if params_hash_key is None:
|
|
||||||
self.given_hash = given_hash_or_params
|
|
||||||
else:
|
|
||||||
self.given_hash = given_hash_or_params.get(params_hash_key)
|
|
||||||
seed = getattr(settings, 'CONSERVANCY_SECRET_KEY', '').encode('utf-8')
|
|
||||||
self.hasher = hashlib.sha256(seed)
|
|
||||||
if isinstance(self.given_hash, str):
|
|
||||||
self.hash_type = type(self.given_hash)
|
|
||||||
else:
|
|
||||||
self.hash_type = type(self.hasher.hexdigest())
|
|
||||||
self.valid = None
|
|
||||||
if not (self.given_hash and seed):
|
|
||||||
self.fail()
|
|
||||||
|
|
||||||
def __enter__(self):
|
|
||||||
self.valid = self.valid and None
|
|
||||||
return self
|
|
||||||
|
|
||||||
def __exit__(self, exc_type, exc_value, exc_tb):
|
|
||||||
if exc_type is None:
|
|
||||||
self.check()
|
|
||||||
else:
|
|
||||||
self.fail()
|
|
||||||
|
|
||||||
def validate(self, data):
|
|
||||||
self.valid = self.valid and None
|
|
||||||
self.hasher.update(data)
|
|
||||||
|
|
||||||
def check(self):
|
|
||||||
if self.valid or (self.valid is None):
|
|
||||||
self.valid = self.hash_type(self.hasher.hexdigest()) == self.given_hash
|
|
||||||
return self.valid
|
|
||||||
|
|
||||||
def fail(self):
|
|
||||||
self.valid = False
|
|
|
@ -1,5 +1,5 @@
|
||||||
from django.conf.urls import include, patterns, url
|
from django.conf.urls import include, patterns, url
|
||||||
|
|
||||||
urlpatterns = patterns('conservancy.apps.contacts.views',
|
urlpatterns = patterns('www.contacts.views',
|
||||||
(r'^/?$', 'subscribe'),
|
(r'^/?$', 'subscribe'),
|
||||||
)
|
)
|
|
@ -14,12 +14,12 @@ info_dict = {
|
||||||
# make_object_list=True)),
|
# make_object_list=True)),
|
||||||
# )
|
# )
|
||||||
|
|
||||||
# urlpatterns += patterns('conservancy.apps.events.views',
|
# urlpatterns += patterns('www.events.views',
|
||||||
# (r'^/?$', 'custom_index', dict(info_dict, queryset=Event.past.all(), paginate_by=10)),
|
# (r'^/?$', 'custom_index', dict(info_dict, queryset=Event.past.all(), paginate_by=10)),
|
||||||
# (r'^(?P<year>\d{4})/(?P<slug>[-\w]+)/$', 'event_detail', dict(info_dict, slug_field='slug')),
|
# (r'^(?P<year>\d{4})/(?P<slug>[-\w]+)/$', 'event_detail', dict(info_dict, slug_field='slug')),
|
||||||
# (r'^ics/$', 'future_event_ics', info_dict),
|
# (r'^ics/$', 'future_event_ics', info_dict),
|
||||||
# )
|
# )
|
||||||
|
|
||||||
urlpatterns = patterns('conservancy.apps.events.views',
|
urlpatterns = patterns('www.events.views',
|
||||||
(r'^.*$', 'custom_index', dict(info_dict, queryset=Event.past.all(), paginate_by=10)),
|
(r'^.*$', 'custom_index', dict(info_dict, queryset=Event.past.all(), paginate_by=10)),
|
||||||
)
|
)
|
|
@ -8,8 +8,8 @@ from django.contrib.syndication.views import Feed
|
||||||
from django.shortcuts import render
|
from django.shortcuts import render
|
||||||
from django.utils.feedgenerator import Rss201rev2Feed
|
from django.utils.feedgenerator import Rss201rev2Feed
|
||||||
|
|
||||||
from .apps.blog.models import Entry as BlogEntry
|
from .blog.models import Entry as BlogEntry
|
||||||
from .apps.news.models import PressRelease
|
from .news.models import PressRelease
|
||||||
|
|
||||||
|
|
||||||
class ConservancyFeedBase(Feed):
|
class ConservancyFeedBase(Feed):
|
|
@ -2,4 +2,4 @@ from django.apps import AppConfig
|
||||||
|
|
||||||
|
|
||||||
class FOSSYConfig(AppConfig):
|
class FOSSYConfig(AppConfig):
|
||||||
name = 'conservancy.apps.fossy'
|
name = 'www.fossy'
|
|
@ -2,9 +2,9 @@ from datetime import datetime
|
||||||
|
|
||||||
from django.shortcuts import render
|
from django.shortcuts import render
|
||||||
|
|
||||||
from .apps.blog.models import Entry
|
from .blog.models import Entry
|
||||||
from .apps.news.models import PressRelease
|
from .news.models import PressRelease
|
||||||
from .apps.supporters.models import Supporter
|
from .supporters.models import Supporter
|
||||||
|
|
||||||
|
|
||||||
def view(request):
|
def view(request):
|
|
@ -1,7 +1,7 @@
|
||||||
from datetime import datetime as DateTime
|
from datetime import datetime as DateTime
|
||||||
|
|
||||||
from . import settings
|
from . import settings
|
||||||
from .apps.fundgoal.models import FundraisingGoal
|
from .fundgoal.models import FundraisingGoal
|
||||||
|
|
||||||
SITE_FUNDGOAL = 'cy2022-end-year-match'
|
SITE_FUNDGOAL = 'cy2022-end-year-match'
|
||||||
|
|
|
@ -1,15 +0,0 @@
|
||||||
#!/usr/bin/env python
|
|
||||||
|
|
||||||
import os
|
|
||||||
import sys
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
www_path = os.path.abspath(os.path.dirname(sys.argv[0]))
|
|
||||||
if www_path not in sys.path:
|
|
||||||
sys.path.append(www_path)
|
|
||||||
|
|
||||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "conservancy.settings")
|
|
||||||
|
|
||||||
from django.core.management import execute_from_command_line
|
|
||||||
|
|
||||||
execute_from_command_line(sys.argv)
|
|
|
@ -4,7 +4,7 @@ from django.conf import settings
|
||||||
from django.contrib.sites.models import Site
|
from django.contrib.sites.models import Site
|
||||||
from django.db import models
|
from django.db import models
|
||||||
|
|
||||||
from ... import bsoup
|
from .. import bsoup
|
||||||
from ..events.models import Event
|
from ..events.models import Event
|
||||||
from ..staff.models import Person
|
from ..staff.models import Person
|
||||||
|
|
|
@ -19,10 +19,10 @@
|
||||||
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
from djangocommonsettings import *
|
from .djangocommonsettings import *
|
||||||
|
|
||||||
SITE_ID = 2
|
SITE_ID = 2
|
||||||
ROOT_URLCONF = 'conservancy.urls'
|
ROOT_URLCONF = 'www.urls'
|
||||||
|
|
||||||
FORCE_CANONICAL_HOSTNAME = False if DEBUG else 'sfconservancy.org'
|
FORCE_CANONICAL_HOSTNAME = False if DEBUG else 'sfconservancy.org'
|
||||||
|
|
||||||
|
@ -87,31 +87,31 @@ INSTALLED_APPS = [
|
||||||
'django.contrib.messages',
|
'django.contrib.messages',
|
||||||
'django.contrib.humanize',
|
'django.contrib.humanize',
|
||||||
'django.contrib.staticfiles',
|
'django.contrib.staticfiles',
|
||||||
'conservancy.apps.blog',
|
'www.blog',
|
||||||
'conservancy.apps.contacts',
|
'www.contacts',
|
||||||
'conservancy.apps.contractpatch',
|
'www.contractpatch',
|
||||||
'conservancy.apps.events',
|
'www.events',
|
||||||
'conservancy.apps.news',
|
'www.news',
|
||||||
'conservancy.apps.staff',
|
'www.staff',
|
||||||
# 'conservancy.apps.summit_registration',
|
# 'www.summit_registration',
|
||||||
'conservancy.apps.worldmap',
|
'www.worldmap',
|
||||||
'conservancy.apps.supporters',
|
'www.supporters',
|
||||||
'conservancy.apps.fundgoal',
|
'www.fundgoal',
|
||||||
'conservancy.apps.assignment',
|
'www.assignment',
|
||||||
'conservancy.apps.fossy',
|
'www.fossy',
|
||||||
'podjango',
|
'www.podjango',
|
||||||
'usethesource.apps.UseTheSourceConfig',
|
'www.usethesource.apps.UseTheSourceConfig',
|
||||||
]
|
]
|
||||||
|
|
||||||
DEFAULT_AUTO_FIELD = 'django.db.models.AutoField'
|
DEFAULT_AUTO_FIELD = 'django.db.models.AutoField'
|
||||||
|
|
||||||
BASE_DIR = Path(__file__).resolve().parent.parent
|
BASE_DIR = Path(__file__).resolve().parent
|
||||||
TEMPLATES = [
|
TEMPLATES = [
|
||||||
{
|
{
|
||||||
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
||||||
'DIRS': [
|
'DIRS': [
|
||||||
BASE_DIR / 'conservancy' / 'templates',
|
BASE_DIR / 'templates',
|
||||||
BASE_DIR / 'conservancy' / 'static',
|
BASE_DIR / 'static',
|
||||||
],
|
],
|
||||||
'APP_DIRS': True,
|
'APP_DIRS': True,
|
||||||
'OPTIONS': {
|
'OPTIONS': {
|
||||||
|
@ -120,8 +120,8 @@ TEMPLATES = [
|
||||||
'django.template.context_processors.request',
|
'django.template.context_processors.request',
|
||||||
'django.contrib.auth.context_processors.auth',
|
'django.contrib.auth.context_processors.auth',
|
||||||
'django.contrib.messages.context_processors.messages',
|
'django.contrib.messages.context_processors.messages',
|
||||||
'conservancy.local_context_processors.host_url',
|
'www.local_context_processors.host_url',
|
||||||
'conservancy.local_context_processors.sitefundraiser',
|
'www.local_context_processors.sitefundraiser',
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -129,7 +129,7 @@ TEMPLATES = [
|
||||||
|
|
||||||
STATIC_ROOT = BASE_DIR.parent / 'collected_static'
|
STATIC_ROOT = BASE_DIR.parent / 'collected_static'
|
||||||
STATICFILES_DIRS = [
|
STATICFILES_DIRS = [
|
||||||
BASE_DIR / 'conservancy' / 'static',
|
BASE_DIR / 'static',
|
||||||
]
|
]
|
||||||
|
|
||||||
MIDDLEWARE = [
|
MIDDLEWARE = [
|
||||||
|
@ -137,6 +137,6 @@ MIDDLEWARE = [
|
||||||
'django.contrib.sessions.middleware.SessionMiddleware',
|
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||||
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||||
'django.contrib.messages.middleware.MessageMiddleware',
|
'django.contrib.messages.middleware.MessageMiddleware',
|
||||||
'conservancy.middleware.ForceCanonicalHostnameMiddleware',
|
'www.middleware.ForceCanonicalHostnameMiddleware',
|
||||||
# 'django.middleware.doc.XViewMiddleware',
|
# 'django.middleware.doc.XViewMiddleware',
|
||||||
]
|
]
|
|
@ -2,7 +2,7 @@ from datetime import datetime, timedelta
|
||||||
|
|
||||||
from django.shortcuts import render
|
from django.shortcuts import render
|
||||||
|
|
||||||
from .apps.supporters.models import Supporter
|
from .supporters.models import Supporter
|
||||||
|
|
||||||
|
|
||||||
def view(request):
|
def view(request):
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue