mirror of
https://github.com/etesync/server
synced 2024-12-27 09:48:24 +00:00
Remove leftover files from EteSync 1.0.
No idea how they got here.
This commit is contained in:
parent
843b59a0ac
commit
65319047b8
@ -1,15 +0,0 @@
|
||||
[global]
|
||||
secret_file = secret.txt
|
||||
debug = false
|
||||
;Advanced options, only uncomment if you know what you're doing:
|
||||
;static_root = /path/to/static
|
||||
;static_url = /static/
|
||||
;language_code = en-us
|
||||
;time_zone = UTC
|
||||
|
||||
[allowed_hosts]
|
||||
allowed_host1 = example.com
|
||||
|
||||
[database]
|
||||
engine = django.db.backends.sqlite3
|
||||
name = db.sqlite3
|
@ -1,14 +0,0 @@
|
||||
# Copyright © 2017 Tom Hacohen
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, version 3.
|
||||
#
|
||||
# This library is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
@ -1,185 +0,0 @@
|
||||
# Copyright © 2017 Tom Hacohen
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, version 3.
|
||||
#
|
||||
# This library is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
"""
|
||||
Django settings for etesync_server project.
|
||||
|
||||
Generated by 'django-admin startproject' using Django 2.0.5.
|
||||
|
||||
For more information on this file, see
|
||||
https://docs.djangoproject.com/en/2.0/topics/settings/
|
||||
|
||||
For the full list of settings and their values, see
|
||||
https://docs.djangoproject.com/en/2.0/ref/settings/
|
||||
"""
|
||||
|
||||
import os
|
||||
import configparser
|
||||
from .utils import get_secret_from_file
|
||||
|
||||
# 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/2.0/howto/deployment/checklist/
|
||||
|
||||
# SECURITY WARNING: keep the secret key used in production secret!
|
||||
# See secret.py for how this is generated; uses a file 'secret.txt' in the root
|
||||
# directory
|
||||
SECRET_FILE = os.path.join(BASE_DIR, "secret.txt")
|
||||
|
||||
# SECURITY WARNING: don't run with debug turned on in production!
|
||||
DEBUG = False
|
||||
|
||||
ALLOWED_HOSTS = []
|
||||
|
||||
# Database
|
||||
# https://docs.djangoproject.com/en/2.0/ref/settings/#databases
|
||||
|
||||
DATABASES = {
|
||||
'default': {
|
||||
'ENGINE': 'django.db.backends.sqlite3',
|
||||
'NAME': os.environ.get('ETESYNC_DB_PATH',
|
||||
os.path.join(BASE_DIR, 'db.sqlite3')),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# Application definition
|
||||
|
||||
INSTALLED_APPS = [
|
||||
'django.contrib.admin',
|
||||
'django.contrib.auth',
|
||||
'django.contrib.contenttypes',
|
||||
'django.contrib.sessions',
|
||||
'django.contrib.messages',
|
||||
'django.contrib.staticfiles',
|
||||
'corsheaders',
|
||||
'rest_framework',
|
||||
'rest_framework.authtoken',
|
||||
'journal.apps.JournalConfig',
|
||||
]
|
||||
|
||||
MIDDLEWARE = [
|
||||
'django.middleware.security.SecurityMiddleware',
|
||||
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||
'corsheaders.middleware.CorsMiddleware',
|
||||
'django.middleware.common.CommonMiddleware',
|
||||
'django.middleware.csrf.CsrfViewMiddleware',
|
||||
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||
'django.contrib.messages.middleware.MessageMiddleware',
|
||||
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
||||
]
|
||||
|
||||
ROOT_URLCONF = 'etesync_server.urls'
|
||||
|
||||
TEMPLATES = [
|
||||
{
|
||||
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
||||
'DIRS': [
|
||||
os.path.join(BASE_DIR, 'templates')
|
||||
],
|
||||
'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 = 'etesync_server.wsgi.application'
|
||||
|
||||
|
||||
# Password validation
|
||||
# https://docs.djangoproject.com/en/2.0/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/2.0/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/2.0/howto/static-files/
|
||||
|
||||
STATIC_URL = '/static/'
|
||||
STATIC_ROOT = os.path.join(BASE_DIR, 'static/')
|
||||
|
||||
|
||||
# Define where to find configuration files
|
||||
config_locations = ['etesync-server.ini', '/etc/etesync-server/etesync-server.ini']
|
||||
# Use config file if present
|
||||
if any(os.path.isfile(x) for x in config_locations):
|
||||
config = configparser.ConfigParser()
|
||||
config.read(config_locations)
|
||||
|
||||
section = config['global']
|
||||
|
||||
SECRET_FILE = section.get('secret_file', SECRET_FILE)
|
||||
STATIC_ROOT = section.get('static_root', STATIC_ROOT)
|
||||
STATIC_URL = section.get('static_url', STATIC_URL)
|
||||
LANGUAGE_CODE = section.get('language_code', LANGUAGE_CODE)
|
||||
TIME_ZONE = section.get('time_zone', TIME_ZONE)
|
||||
DEBUG = section.getboolean('debug', DEBUG)
|
||||
|
||||
if 'allowed_hosts' in config:
|
||||
ALLOWED_HOSTS = [y for x, y in config.items('allowed_hosts')]
|
||||
|
||||
if 'database' in config:
|
||||
DATABASES = { 'default': { x.upper(): y for x, y in config.items('database') } }
|
||||
|
||||
JOURNAL_API_PERMISSIONS = (
|
||||
'rest_framework.permissions.IsAuthenticated',
|
||||
)
|
||||
|
||||
# Cors
|
||||
CORS_ORIGIN_ALLOW_ALL = True
|
||||
|
||||
# Make an `etesync_site_settings` module available to override settings.
|
||||
try:
|
||||
from etesync_site_settings import *
|
||||
except ImportError:
|
||||
pass
|
||||
|
||||
if 'SECRET_KEY' not in locals():
|
||||
SECRET_KEY = get_secret_from_file(SECRET_FILE)
|
@ -1,70 +0,0 @@
|
||||
# Copyright © 2017 Tom Hacohen
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, version 3.
|
||||
#
|
||||
# This library is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
"""etesync_server URL Configuration
|
||||
|
||||
The `urlpatterns` list routes URLs to views. For more information please see:
|
||||
https://docs.djangoproject.com/en/2.0/topics/http/urls/
|
||||
Examples:
|
||||
Function views
|
||||
1. Add an import: from my_app import views
|
||||
2. Add a URL to urlpatterns: path('', views.home, name='home')
|
||||
Class-based views
|
||||
1. Add an import: from other_app.views import Home
|
||||
2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
|
||||
Including another URLconf
|
||||
1. Import the include() function: from django.urls import include, path
|
||||
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
|
||||
"""
|
||||
from django.conf import settings
|
||||
from django.urls import include, path, re_path
|
||||
from django.contrib import admin
|
||||
from django.views.generic import TemplateView
|
||||
|
||||
from rest_framework_nested import routers
|
||||
from rest_framework.authtoken import views as token_views
|
||||
from rest_framework.decorators import api_view
|
||||
from rest_framework.response import Response
|
||||
|
||||
from journal import views
|
||||
|
||||
router = routers.DefaultRouter()
|
||||
router.register(r'journals', views.JournalViewSet)
|
||||
router.register(r'journal/(?P<journal_uid>[^/]+)', views.EntryViewSet)
|
||||
router.register(r'user', views.UserInfoViewSet)
|
||||
|
||||
journals_router = routers.NestedSimpleRouter(router, r'journals', lookup='journal')
|
||||
journals_router.register(r'members', views.MembersViewSet, basename='journal-members')
|
||||
journals_router.register(r'entries', views.EntryViewSet, basename='journal-entries')
|
||||
|
||||
|
||||
@api_view(['POST'])
|
||||
def nop_view(request):
|
||||
return Response({})
|
||||
|
||||
|
||||
urlpatterns = [
|
||||
re_path(r'^api/v1/', include(router.urls)),
|
||||
re_path(r'^api/v1/', include(journals_router.urls)),
|
||||
re_path(r'^api-auth/', include('rest_framework.urls', namespace='rest_framework')),
|
||||
re_path(r'^api-token-auth/', token_views.obtain_auth_token),
|
||||
path('api/logout/', nop_view),
|
||||
path('admin/', admin.site.urls),
|
||||
path('', TemplateView.as_view(template_name='success.html')),
|
||||
]
|
||||
|
||||
if settings.DEBUG:
|
||||
urlpatterns = [
|
||||
path('reset/', views.reset, name='reset_debug'),
|
||||
] + urlpatterns
|
@ -1,25 +0,0 @@
|
||||
# Copyright © 2017 Tom Hacohen
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, version 3.
|
||||
#
|
||||
# This library is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from django.core.management import utils
|
||||
|
||||
def get_secret_from_file(path):
|
||||
try:
|
||||
with open(path, "r") as f:
|
||||
return f.read().strip()
|
||||
except EnvironmentError:
|
||||
with open(path, "w") as f:
|
||||
secret_key = utils.get_random_secret_key()
|
||||
f.write(secret_key)
|
||||
return secret_key
|
@ -1,16 +0,0 @@
|
||||
"""
|
||||
WSGI config for etesync_server 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/2.0/howto/deployment/wsgi/
|
||||
"""
|
||||
|
||||
import os
|
||||
|
||||
from django.core.wsgi import get_wsgi_application
|
||||
|
||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "etesync_server.settings")
|
||||
|
||||
application = get_wsgi_application()
|
Loading…
Reference in New Issue
Block a user