Signed-off-by: Carl Schwan <carl@carlschwan.eu>
This commit is contained in:
Carl Schwan 2022-01-05 14:14:08 +01:00
Родитель b23ca1ea82
Коммит b304bc9101
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 06B35D38387B67BE
6 изменённых файлов: 1657 добавлений и 31 удалений

Просмотреть файл

@ -1,15 +1,14 @@
venv_bin=venv/bin/
python=$(venv_bin)python
pip=$(venv_bin)pip3
pycodestyle=$(venv_bin)pycodestyle
pyresttest=$(venv_bin)pyresttest
coverage=$(venv_bin)coverage
bandit=$(venv_bin)bandit
mypy=$(venv_bin)mypy
poetry=poetry
poetry_run=$(poetry) run
python=$(poetry_run) python
pycodestyle=$(poetry_run) pycodestyle
pyresttest=$(poetry_run) pyresttest
coverage=$(poetry_run) coverage
bandit=$(poetry_run) bandit
mypy=$(poetry_run) mypy
manage-script=$(CURDIR)/manage.py
manage=$(python) $(manage-script)
manage=$(poetry_run) $(manage-script)
db=sqlite
pyvenv=python3 -m venv
yarn=yarn
prod_version=12.0.0
@ -42,10 +41,7 @@ dev-setup:
rm -f db.sqlite3
$(yarn) install
$(yarn) run build
$(pyvenv) venv
$(pip) install --upgrade pip
$(pip) install -r $(CURDIR)/requirements/development.txt
$(pip) install -r $(CURDIR)/requirements/base.txt
poetry install
ifeq ($(db), postgres)
$(pip) install -r $(CURDIR)/requirements/production.txt
endif
@ -69,8 +65,7 @@ docs:
.PHONY: update-dev-deps
update-dev-deps:
$(pip) install --upgrade -r $(CURDIR)/requirements/development.txt
$(pip) install --upgrade -r $(CURDIR)/requirements/base.txt
$(poetry) upgrade
$(yarn) install --upgrade
.PHONY: authors

Просмотреть файл

@ -10,11 +10,13 @@ For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.11/ref/settings/
"""
from os.path import dirname, abspath, join, pardir, realpath
import pathlib
from django.conf.global_settings import LANGUAGES
BASE_DIR = realpath(join(dirname(dirname(abspath(__file__))), pardir))
BASE_DIR = pathlib.Path(__file__).absolute().parent.parent
print(BASE_DIR)
INSTALLED_APPS = [
'nextcloudappstore.core.apps.CoreConfig',
@ -26,7 +28,6 @@ INSTALLED_APPS = [
'rest_framework',
'rest_framework.authtoken',
'corsheaders',
'snowpenguin.django.recaptcha2',
'allauth',
'allauth.account',
'allauth.socialaccount',
@ -39,6 +40,7 @@ INSTALLED_APPS = [
'django.contrib.sites',
'django.contrib.staticfiles',
'django.contrib.humanize',
'captcha',
]
MIDDLEWARE = [
@ -59,7 +61,7 @@ ROOT_URLCONF = 'nextcloudappstore.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'DIRS': [BASE_DIR / "templates"],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
@ -77,9 +79,9 @@ WSGI_APPLICATION = 'nextcloudappstore.wsgi.application'
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': join(BASE_DIR, 'db.sqlite3'),
'NAME': 'db.sqlite3',
'TEST': {
'NAME': join(BASE_DIR, 'test.sqlite3'),
'NAME': 'test.sqlite3',
}
}
}
@ -172,8 +174,8 @@ PARLER_LANGUAGES = {
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.11/howto/static-files/
MEDIA_ROOT = join(BASE_DIR, 'media')
STATIC_ROOT = join(BASE_DIR, 'static')
MEDIA_ROOT = BASE_DIR / 'media'
STATIC_ROOT = BASE_DIR / 'static'
STATIC_URL = '/static/'
MEDIA_URL = '/media/'
@ -220,7 +222,7 @@ LOGIN_REDIRECT_URL = 'home'
LOGIN_URL = 'account_login'
LOG_LEVEL = 'WARNING'
LOG_FILE = join(BASE_DIR, 'appstore.log')
LOG_FILE = BASE_DIR / 'appstore.log'
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
@ -240,7 +242,7 @@ LOGGING = {
},
}
LOCALE_PATHS = (
join(BASE_DIR, 'locale/'),
BASE_DIR / 'locale/',
)
# Disable in order for cooldown periods to work properly
@ -270,10 +272,10 @@ ARCHIVE_FOLDER_BLACKLIST = {
}
# certificate location configuration
NEXTCLOUD_CERTIFICATE_LOCATION = join(
BASE_DIR, 'nextcloudappstore/certificate/nextcloud.crt')
NEXTCLOUD_CRL_LOCATION = join(
BASE_DIR, 'nextcloudappstore/certificate/nextcloud.crl')
NEXTCLOUD_CERTIFICATE_LOCATION = BASE_DIR / \
'nextcloudappstore/certificate/nextcloud.crt'
NEXTCLOUD_CRL_LOCATION = BASE_DIR / \
'nextcloudappstore/certificate/nextcloud.crl'
# whitelist for serializing markdown
MARKDOWN_ALLOWED_TAGS = [

1567
poetry.lock сгенерированный Normal file

Разница между файлами не показана из-за своего большого размера Загрузить разницу

2
poetry.toml Normal file
Просмотреть файл

@ -0,0 +1,2 @@
[virtualenvs]
in-project = true

48
pyproject.toml Normal file
Просмотреть файл

@ -0,0 +1,48 @@
[tool.poetry]
name = "nextcloudappstore/"
version = "1.0.0"
description = "App store for Nextcloud apps"
authors = ["Morris Jobke <hey@morrisjobke.de>"]
[tool.poetry.dependencies]
python = "3.6"
Django = "3.2"
django-braces = "~1.13"
djangorestframework-camel-case = "^1.3.0"
django-parler-rest = "^2.1"
django-parler = "^2.3"
django-allauth = "^0.47.0"
lxml = "^4.7.1"
requests = "^2.27.0"
django-cors-middleware = "^1.5.0"
django-csp = "^3.7"
pyOpenSSL = "^21.0.0"
Markdown = "^3.3.6"
bleach = "^4.1.0"
pymple = "^0.1.3"
semantic-version = "^2.8.5"
pem = "^21.2.0"
django-simple-captcha = "^0.5.14"
uWSGI = "^2.0.20"
newrelic = "^7.2.4"
psycopg2 = "^2.9.3"
[tool.poetry.dev-dependencies]
pytest = "*"
pytest-cov = "*"
pytest-django = "*"
responses = "*"
django_compressor = "^2.4"
pycodestyle = "*"
mypy = "*"
bandit = "*"
django-debug-toolbar = "*"
coverage = "*"
selenium = ""
coveralls = "*"
types-requests = "^2.26.3"
types-pyOpenSSL = "^21.0.2"
[build-system]
requires = ["poetry>=0.12"]
build-backend = "poetry.masonry.api"

Просмотреть файл

@ -14,7 +14,7 @@ INTERNAL_IPS = ('127.0.0.1',)
VALIDATE_CERTIFICATES = False
FIXTURE_DIRS = (
join(BASE_DIR, 'nextcloudappstore/core/tests/e2e/fixtures'),
BASE_DIR / 'nextcloudappstore/core/tests/e2e/fixtures',
)
LOGGING['handlers']['console'] = {
@ -28,3 +28,15 @@ CSP_EXCLUDE_URL_PREFIXES = ('/api/v1',)
REST_FRAMEWORK['DEFAULT_THROTTLE_RATES']['app_upload'] = '10000/day'
REST_FRAMEWORK['DEFAULT_THROTTLE_RATES']['app_register'] = '10000/day'
import sys
if 'test' in sys.argv:
DATABASES['default'] = {'ENGINE': 'django.db.backends.sqlite3'}
# For development, dump email to the console instead of trying to actually send it.
# EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
# Alternatively, run python3 -m smtpd -n -c DebuggingServer -d '0.0.0.0:2525' and set
# EMAIL_PORT = 2525
EMAIL_HOST = 'localhost'
EMAIL_HOST_USER = "noreply@nextcloud.com"