This commit is contained in:
Bernhard Posselt 2016-06-05 13:14:14 +02:00
Коммит 9dc2d7bfc9
31 изменённых файлов: 335 добавлений и 0 удалений

13
.editorconfig Normal file
Просмотреть файл

@ -0,0 +1,13 @@
root = true
[*]
trim_trailing_whitespace = true
[*.{js,py,html}]
indent_style = space
indent_size = 4
charset = utf-8
[Makefile]
indent_style = tab
indent_size = 4

17
.gitignore поставляемый Normal file
Просмотреть файл

@ -0,0 +1,17 @@
*.egg-info
*.pot
*.py[co]
__pycache__
MANIFEST
dist/
docs/_build/
docs/locale/
node_modules/
tests/coverage_html/
tests/.coverage
build/
tests/report/
venv
.idea
*.iml
nextcloudappstore/local_settings.py

11
.travis.yml Normal file
Просмотреть файл

@ -0,0 +1,11 @@
sudo: false
language: python
python:
- "3.4"
- "3.5"
before_install:
- pip install pep8 mypy-lang
script:
- make test

2
Makefile Normal file
Просмотреть файл

@ -0,0 +1,2 @@
test:
pep8 nextcloudappstore

10
manage.py Executable file
Просмотреть файл

@ -0,0 +1,10 @@
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "nextcloudappstore.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)

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

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

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

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

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

@ -0,0 +1,5 @@
from django.apps import AppConfig
class ApiConfig(AppConfig):
name = 'api'

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

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

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

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

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

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

@ -0,0 +1,3 @@
from django.shortcuts import render
# Create your views here.

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

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

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

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

@ -0,0 +1,5 @@
from django.apps import AppConfig
class CommonConfig(AppConfig):
name = 'core'

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

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

@ -0,0 +1,74 @@
from django.db import models
from django.utils.translation import ugettext_lazy as _
class App(models.Model):
id = models.CharField(max_length=128, unique=True,
help_text=_('app id, same as the folder name'))
categories = models.ManyToManyField(Category)
authors = models.ManyToManyField(Author)
# possible l10n candidates
name = models.CharField(max_length=128)
description = models.TextField()
# resources
user_docs = models.URLField(max_length=256, blank=True)
admin_docs = models.URLField(max_length=256, blank=True)
developer_docs = models.URLField(max_length=256, blank=True)
issue_tracker = models.URLField(max_length=256, blank=True)
website = models.URLField(max_length=256, blank=True)
class AppRelease(models.Model):
version = models.CharField(max_length=128, unique=True)
app = models.ForeignKey(App, on_delete=models.CASCADE)
# dependencies
libs = models.ManyToManyField(Library, through='LibraryDependency')
databases = models.ManyToManyField(Database, through='DatabaseDependency')
php_min = models.CharField(max_length=32)
php_max = models.CharField(max_length=32, blank=True)
platform_min = models.CharField(max_length=32)
platform_max = models.CharField(max_length=32, blank=True)
download = models.URLField(max_length=256, blank=True)
class Screenshot(models.Model):
image = models.ImageField()
app = models.ForeignKey(App, on_delete=models.CASCADE)
class Author(models.Model):
name = models.CharField(max_length=256)
mail = models.EmailField(max_length=256, blank=True)
homepage = models.URLField(max_length=256, blank=True)
class Command(models.Model):
name = models.CharField(max_length=128, unique=True)
class Category(models.Model):
id = models.CharField(max_length=128, unique=True)
# possible l10n
name = models.CharField(max_length=128, unique=True)
class Database(models.Model):
id = models.CharField(max_length=128, unique=True)
class DatabaseDependency(models.Model):
app = models.ForeignKey(AppRelease, on_delete=models.CASCADE)
database = models.ForeignKey(Database, on_delete=models.CASCADE)
version_min = models.CharField(max_length=32)
version_max = models.CharField(max_length=32, blank=True)
class Library(models.Model):
id = models.CharField(max_length=128, unique=True)
class LibraryDependency(models.Model):
app_release = models.ForeignKey(AppRelease, on_delete=models.CASCADE)
library = models.ForeignKey(Library, on_delete=models.CASCADE)
version_min = models.CharField(max_length=32)
version_max = models.CharField(max_length=32, blank=True)

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

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

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

@ -0,0 +1,3 @@
from django.shortcuts import render
# Create your views here.

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

@ -0,0 +1,122 @@
"""
Django settings for nextcloudappstore project.
Generated by 'django-admin startproject' using Django 1.9.6.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.9/ref/settings/
"""
import os
# 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/1.9/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'r72b878*dbn%ftz0#m=+p!4j-0ein@kz(*z%v)ina$t@zh9=xb'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
ALLOWED_HOSTS = []
# Application definition
INSTALLED_APPS = [
'nextcloudappstore.core',
'nextcloudappstore.api',
'nextcloudappstore.website',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
]
MIDDLEWARE_CLASSES = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]
ROOT_URLCONF = 'nextcloudappstore.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'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 = 'nextcloudappstore.wsgi.application'
# Database
# https://docs.djangoproject.com/en/1.9/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
}
# Password validation
# https://docs.djangoproject.com/en/1.9/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/1.9/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/1.9/howto/static-files/
STATIC_URL = '/static/'
try:
from nextcloudappstore.local_settings import *
except:
pass

21
nextcloudappstore/urls.py Normal file
Просмотреть файл

@ -0,0 +1,21 @@
"""nextcloudappstore URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.9/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-based views
1. Add an import: from other_app.views import Home
2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home')
Including another URLconf
1. Import the include() function: from django.conf.urls import url, include
2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls'))
"""
from django.conf.urls import url
from django.contrib import admin
urlpatterns = [
url(r'^admin/', admin.site.urls),
]

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

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

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

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

@ -0,0 +1,5 @@
from django.apps import AppConfig
class WebsiteConfig(AppConfig):
name = 'website'

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

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

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

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

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

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

@ -0,0 +1,3 @@
from django.shortcuts import render
# Create your views here.

16
nextcloudappstore/wsgi.py Normal file
Просмотреть файл

@ -0,0 +1,16 @@
"""
WSGI config for nextcloudappstore 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/1.9/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "nextcloudappstore.settings")
application = get_wsgi_application()

1
requirements.txt Normal file
Просмотреть файл

@ -0,0 +1 @@
Django>=1.9.6,<1.10