Browse Source

Refactor: snake to camelcase, relative imports for the same package, Variables Unique

Redoing the same changeset with the webapp renaming
layerset
Till Wegmüller 6 years ago
parent
commit
3e29de0311
  1. 42
      cmd/imageadm/build.go
  2. 18
      cmd/imageadm/config.go
  3. 26
      cmd/imageadm/create.go
  4. 12
      cmd/imageadm/deploy.go
  5. 2
      cmd/imageadm/import-tar.go
  6. 26
      cmd/imageadm/resolve.go
  7. 32
      cmd/imageadm/root.go
  8. 34
      cmd/imageadm/set-config.go
  9. 4
      cmd/podadm/root.go
  10. 2
      pod/main.go
  11. 22
      webapp/manage.py
  12. 7
      webapp/webapp/__init__.py
  13. 22
      webapp/webapp/celery.py
  14. 137
      webapp/webapp/settings.py
  15. 23
      webapp/webapp/urls.py
  16. 16
      webapp/webapp/wsgi.py
  17. 0
      webapp_old/opcbase/__init__.py
  18. 0
      webapp_old/opcbase/admin.py
  19. 0
      webapp_old/opcbase/apps.py
  20. 0
      webapp_old/opcbase/fixtures/users.json
  21. 0
      webapp_old/opcbase/migrations/0001_initial.py
  22. 0
      webapp_old/opcbase/migrations/0002_auto_20161130_1655.py
  23. 0
      webapp_old/opcbase/migrations/0003_auto_20161202_1111.py
  24. 0
      webapp_old/opcbase/migrations/__init__.py
  25. 0
      webapp_old/opcbase/models.py
  26. 0
      webapp_old/opcbase/permissions.py
  27. 0
      webapp_old/opcbase/serializers.py
  28. 0
      webapp_old/opcbase/tasks.py
  29. 0
      webapp_old/opcbase/templates/index.html
  30. 0
      webapp_old/opcbase/tests.py
  31. 0
      webapp_old/opcbase/urls.py
  32. 0
      webapp_old/opcbase/views.py
  33. 0
      webapp_old/opcwebhosting/__init__.py
  34. 0
      webapp_old/opcwebhosting/admin.py
  35. 0
      webapp_old/opcwebhosting/apps.py
  36. 0
      webapp_old/opcwebhosting/migrations/__init__.py
  37. 0
      webapp_old/opcwebhosting/models.py
  38. 0
      webapp_old/opcwebhosting/tests.py
  39. 0
      webapp_old/opcwebhosting/views.py

42
cmd/imageadm/build.go

@ -6,17 +6,17 @@ import (
"os"
"path/filepath"
"git.wegmueller.it/opencloud/opencloud/image"
"../../image"
"github.com/spf13/cobra"
)
var (
build_type string
build_notresolve bool
build_output string
buildType string
buildNotresolve bool
buildOutput string
)
const build_default_baseDir = "/tmp"
const buildDefaultBaseDir = "/tmp"
// buildCmd represents the create command
var buildCmd = &cobra.Command{
@ -30,15 +30,15 @@ var buildCmd = &cobra.Command{
func init() {
RootCmd.AddCommand(buildCmd)
buildCmd.Flags().StringVarP(&build_type, "type", "t", "", "use to overwrite the type of image to build")
buildCmd.Flags().BoolVarP(&build_notresolve, "notresolve", "n", false, "Use files in profile and not resolve from Filesystem")
buildCmd.Flags().StringVarP(&build_output, "output", "o", build_default_baseDir, "The Directory where a build will be saved to. defaults to /tmp/imgname")
buildCmd.Flags().StringVarP(&buildType, "type", "t", "", "use to overwrite the type of image to build")
buildCmd.Flags().BoolVarP(&buildNotresolve, "notresolve", "n", false, "Use files in profile and not resolve from Filesystem")
buildCmd.Flags().StringVarP(&buildOutput, "output", "o", buildDefaultBaseDir, "The Directory where a build will be saved to. defaults to /tmp/imgname")
}
func runBuild(cmd *cobra.Command, args []string) {
profilePath, err := filepath.Abs(profile)
profilePath, err := filepath.Abs(rootProfile)
if err != nil {
fmt.Printf("Cannot resolve absolute path of %s: %s", profile, err)
fmt.Printf("Cannot resolve absolute path of %s: %s", rootProfile, err)
os.Exit(1)
}
profile, err := image.LoadProfile(profilePath)
@ -46,30 +46,30 @@ func runBuild(cmd *cobra.Command, args []string) {
fmt.Printf("%s is not a Profile: %s", profilePath, err)
os.Exit(1)
}
config, err := image.LoadConfiguration(cfgFile)
config, err := image.LoadConfiguration(rootCfgFile)
if err != nil {
fmt.Printf("Cannot Load Configuration: %s", err)
os.Exit(1)
}
if !build_notresolve {
if !buildNotresolve {
profile.Files = config.GetFiles(profile.FileSets)
}
if build_type == "" {
build_type = string(profile.Type)
if buildType == "" {
buildType = string(profile.Type)
}
switch build_type {
switch buildType {
case image.TypeChroot:
err = image.BuildChroot(profile, build_output)
err = image.BuildChroot(profile, buildOutput)
case image.TypeACI:
err = image.BuildACI(profile, build_output)
err = image.BuildACI(profile, buildOutput)
case image.TypeTar:
err = image.BuildTar(profile, build_output)
err = image.BuildTar(profile, buildOutput)
case image.TypeUfs:
err = image.BuildUFS(profile, build_output)
err = image.BuildUFS(profile, buildOutput)
case image.TypeZfs:
err = image.BuildZFS(profile, build_output)
err = image.BuildZFS(profile, buildOutput)
default:
fmt.Printf("Format %s not known", build_type)
fmt.Printf("Format %s not known", buildType)
os.Exit(1)
}
if err != nil {

18
cmd/imageadm/config.go

@ -3,7 +3,7 @@ package cmd
import (
"fmt"
"git.wegmueller.it/opencloud/opencloud/image"
"../../image"
"github.com/spf13/cobra"
)
@ -18,27 +18,17 @@ var configCmd = &cobra.Command{
func init() {
RootCmd.AddCommand(configCmd)
// Here you will define your flags and configuration settings.
// Cobra supports Persistent Flags which will work for this command
// and all subcommands, e.g.:
// createCmd.PersistentFlags().String("foo", "", "A help for foo")
// Cobra supports local flags which will only run when this command
// is called directly, e.g.:
// createCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")
}
func configCmdrun(cmd *cobra.Command, args []string) {
conf, err := image.LoadConfiguration(cfgFile)
conf, err := image.LoadConfiguration(rootCfgFile)
if err != nil {
panic(err)
}
fmt.Println("Configuration:")
for _, section := range conf.Sections{
for _, section := range conf.Sections {
fmt.Printf("[%s]\n", section.Name)
if section.Comment != ""{
if section.Comment != "" {
fmt.Println(section.Comment)
}
if len(section.Paths) > 0 {

26
cmd/imageadm/create.go

@ -5,15 +5,15 @@ import (
"path/filepath"
"git.wegmueller.it/opencloud/opencloud/image"
"../../image"
"github.com/spf13/cobra"
)
var (
imgtype string
imgdir string
sets []string
notresolve bool
createImgtype string
createImgdir string
createSets []string
createNotresolve bool
)
// createCmd represents the create command
@ -30,15 +30,15 @@ var createCmd = &cobra.Command{
func init() {
RootCmd.AddCommand(createCmd)
createCmd.Flags().StringVarP(&imgtype, "type", "t", "chroot", "Set this to Chroot, ZFS or UFS to specify which image to be created.")
createCmd.Flags().StringVarP(&imgdir, "dir", "D", ".", "Which directory to create the image in defaults to ")
createCmd.Flags().StringArrayVarP(&sets, "set", "s", []string{}, "Which Filesets to include in the final Image. use config to show the sets")
createCmd.Flags().BoolVarP(&notresolve, "resolve", "n", false, "If the Files should be resolved from the sets. Defaults to true")
createCmd.Flags().StringVarP(&createImgtype, "type", "t", "chroot", "Set this to Chroot, ZFS or UFS to specify which image to be created.")
createCmd.Flags().StringVarP(&createImgdir, "dir", "D", ".", "Which directory to create the image in defaults to ")
createCmd.Flags().StringArrayVarP(&createSets, "set", "s", []string{}, "Which Filesets to include in the final Image. use config to show the sets")
createCmd.Flags().BoolVarP(&createNotresolve, "resolve", "n", false, "If the Files should be resolved from the sets. Defaults to true")
}
func createCmdrun(cmd *cobra.Command, args []string) {
imgname := args[0]
imgdir, err := filepath.Abs(imgdir)
imgdir, err := filepath.Abs(createImgdir)
if err != nil {
panic(err)
}
@ -53,8 +53,8 @@ func createCmdrun(cmd *cobra.Command, args []string) {
if err != nil {
panic(err)
}
config, err := image.LoadConfiguration(cfgFile)
for _, set := range sets {
config, err := image.LoadConfiguration(rootCfgFile)
for _, set := range createSets {
section, ok := config.Sections[set]
if ok {
profile.FileSets = append(profile.FileSets, set)
@ -63,7 +63,7 @@ func createCmdrun(cmd *cobra.Command, args []string) {
profile.Devices = append(profile.Devices, config.GetAllFromSection(&section, "devices")...)
}
}
if notresolve == false {
if createNotresolve == false {
profile.ResolveFiles(&config)
}
err = profile.Save(imgp)

12
cmd/imageadm/deploy.go

@ -22,15 +22,5 @@ var deployCmd = &cobra.Command{
func init() {
RootCmd.AddCommand(deployCmd)
createCmd.Flags().StringP("host", "H", "http://opencloud.wegmueller.it", "The Url to publish to.")
// Here you will define your flags and configuration settings.
// Cobra supports Persistent Flags which will work for this command
// and all subcommands, e.g.:
// createCmd.PersistentFlags().String("foo", "", "A help for foo")
// Cobra supports local flags which will only run when this command
// is called directly, e.g.:
// createCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")
deployCmd.Flags().StringP("host", "H", "http://opencloud.wegmueller.it", "The Url to publish to.")
}

2
cmd/imageadm/import-tar.go

@ -31,7 +31,7 @@ var importTarCmd = &cobra.Command{
Short: "Import a OS Tarball",
Long: `Imports an OS Tarball as an Image. The only rule for the tarball is,
that it contains a folders rootfs folder and the root of the OS under that.
This command will then create an empty imageManifest or add the one specified by the -m command.
This command will then create an empty imageManifest or configAdd the one specified by the -m command.
It can also grab a manifest from an existing image with -i.
This command is mostly a workaround for the golang Tar writer failing.
`,

26
cmd/imageadm/resolve.go

@ -6,12 +6,12 @@ import (
"os"
"path/filepath"
"git.wegmueller.it/opencloud/opencloud/image"
"../../image"
"github.com/spf13/cobra"
)
var (
resolve_save bool
resolveSave bool
)
// buildCmd represents the create command
@ -26,23 +26,13 @@ var resolveCmd = &cobra.Command{
func init() {
RootCmd.AddCommand(resolveCmd)
resolveCmd.Flags().BoolVarP(&resolve_save, "save", "s", false, "If the Profile should be Updated with the new files")
// Here you will define your flags and configuration settings.
// Cobra supports Persistent Flags which will work for this command
// and all subcommands, e.g.:
// createCmd.PersistentFlags().String("foo", "", "A help for foo")
// Cobra supports local flags which will only run when this command
// is called directly, e.g.:
// createCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")
resolveCmd.Flags().BoolVarP(&resolveSave, "save", "s", false, "If the Profile should be Updated with the new files")
}
func runResolve(cmd *cobra.Command, args []string) {
profilePath, err := filepath.Abs(profile)
profilePath, err := filepath.Abs(rootProfile)
if err != nil {
fmt.Printf("Cannot resolve absolute path of %s: %s", profile, err)
fmt.Printf("Cannot resolve absolute path of %s: %s", rootProfile, err)
os.Exit(1)
}
profile, err := image.LoadProfile(profilePath)
@ -50,7 +40,7 @@ func runResolve(cmd *cobra.Command, args []string) {
fmt.Printf("%s is not a Profile: %s", profilePath, err)
os.Exit(1)
}
config,err := image.LoadConfiguration(cfgFile)
config, err := image.LoadConfiguration(rootCfgFile)
if err != nil {
fmt.Printf("Cannot Load Configuration: %s", err)
os.Exit(1)
@ -59,7 +49,7 @@ func runResolve(cmd *cobra.Command, args []string) {
for _, file := range files {
fmt.Println(file)
}
if resolve_save {
if resolveSave {
profile.Files = files
err := profile.Save(filepath.Dir(profilePath))
if err != nil {
@ -70,4 +60,4 @@ func runResolve(cmd *cobra.Command, args []string) {
fmt.Printf("Image Creation Failed: %s\n", err)
os.Exit(1)
}
}
}

32
cmd/imageadm/root.go

@ -1,33 +1,19 @@
// Copyright © 2017 NAME HERE <EMAIL ADDRESS>
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package cmd
import (
"fmt"
"os"
"git.wegmueller.it/opencloud/opencloud/image"
"../../image"
"git.wegmueller.it/toasterson/glog"
"github.com/spf13/cobra"
)
var (
cfgFile string
profile string
loglevel string
debug bool
rootCfgFile string
rootProfile string
loglevel string
debug bool
)
// RootCmd represents the base command when called without any subcommands
@ -52,7 +38,7 @@ func Execute() {
}
}
func initLogLevel(cmd *cobra.Command, args []string){
func initLogLevel(cmd *cobra.Command, args []string) {
if loglevel != "" {
glog.SetLevelFromString(loglevel)
}
@ -65,8 +51,8 @@ func init() {
// Here you will define your flags and configuration settings.
// Cobra supports persistent flags, which, if defined here,
// will be global for your application.
RootCmd.PersistentFlags().StringVarP(&cfgFile, "config", "c", image.Default_path, "config file ")
RootCmd.PersistentFlags().StringVarP(&profile, "profile", "p", "./profile.json", "The Profile file to use. Defaults to profile.json in pwd")
RootCmd.PersistentFlags().StringVarP(&rootCfgFile, "config", "c", image.Default_path, "config file ")
RootCmd.PersistentFlags().StringVarP(&rootProfile, "profile", "p", "./profile.json", "The Profile file to use. Defaults to profile.json in pwd")
RootCmd.PersistentFlags().BoolVarP(&debug, "debug", "d", false, "Enable Debuging")
RootCmd.PersistentFlags().StringVar(&loglevel, "loglevel", "", "Set the Log Level")
}
}

34
cmd/imageadm/set-config.go

@ -4,13 +4,13 @@ import (
"fmt"
"strings"
"git.wegmueller.it/opencloud/opencloud/image"
"../../image"
"github.com/spf13/cobra"
)
var (
add bool
remove bool
configAdd bool
configRemove bool
)
// createCmd represents the create command
@ -19,7 +19,7 @@ var setConfigCmd = &cobra.Command{
Short: "Changes the Config",
Long: `Change the configuration from cmdline
use -s to specify which section to edit
use -a to add to existing and -r to remove one entry only
use -a to configAdd to existing and -r to configRemove one entry only
use name=value as positional arguments to specify what to change. multiple positional arguments are accepted
`,
Run: setConfigCmdrun,
@ -27,8 +27,8 @@ var setConfigCmd = &cobra.Command{
if len(args) < 1 {
return fmt.Errorf("at least one argument required")
}
for _, arg := range args{
if !strings.Contains(arg, "="){
for _, arg := range args {
if !strings.Contains(arg, "=") {
return fmt.Errorf("arguments must have name=value syntax. %s does not", arg)
}
}
@ -40,8 +40,8 @@ func init() {
RootCmd.AddCommand(setConfigCmd)
setConfigCmd.Flags().StringP("section", "s", "", "The Section to edit")
setConfigCmd.Flags().BoolVarP(&add, "add", "a", false, "Add the value to the section instead of overwriting it")
setConfigCmd.Flags().BoolVarP(&remove,"remove", "r", false, "Remove the value from the section")
setConfigCmd.Flags().BoolVarP(&configAdd, "configAdd", "a", false, "Add the value to the section instead of overwriting it")
setConfigCmd.Flags().BoolVarP(&configRemove, "configRemove", "r", false, "Remove the value from the section")
// Here you will define your flags and configuration settings.
@ -56,7 +56,7 @@ func init() {
func setConfigCmdrun(cmd *cobra.Command, args []string) {
section := cmd.Flags().Lookup("section").Value.String()
conf, err := image.LoadConfiguration(cfgFile)
conf, err := image.LoadConfiguration(rootCfgFile)
if err != nil {
conf = image.Config{}
}
@ -64,9 +64,9 @@ func setConfigCmdrun(cmd *cobra.Command, args []string) {
if !ok {
sectionObj = image.ConfigSection{Name: section}
}
if remove{
if configRemove {
arg := args[0]
if strings.Contains(arg, "="){
if strings.Contains(arg, "=") {
tmp := strings.SplitN(arg, "=", -1)
name := tmp[0]
val := tmp[1]
@ -120,19 +120,19 @@ func argsToMap(args []string) map[string][]string {
func apply(section *image.ConfigSection, name string, values []string) {
switch name {
case "devices", "dev":
if add {
if configAdd {
section.Devices = append(section.Devices, values...)
} else {
section.Devices = values
}
case "users", "user":
if add {
if configAdd {
section.Users = append(section.Users, values...)
} else {
section.Users = values
}
case "groups", "group":
if add {
if configAdd {
section.Groups = append(section.Groups, values...)
} else {
section.Groups = values
@ -140,13 +140,13 @@ func apply(section *image.ConfigSection, name string, values []string) {
case "comment":
section.Comment = values[0]
case "paths":
if add {
if configAdd {
section.Paths = append(section.Paths, values...)
} else {
section.Paths = values
}
case "deps", "dependencies":
if add {
if configAdd {
section.Dependencies = append(section.Dependencies, values...)
} else {
section.Dependencies = values
@ -175,7 +175,7 @@ func removeEntry(section *image.ConfigSection, name string, value string) {
}
}
func removeOneEntry(xs *[]string, entry string){
func removeOneEntry(xs *[]string, entry string) {
j := 0
for i, x := range *xs {
if x != entry {

4
cmd/podadm/root.go

@ -53,7 +53,7 @@ func Execute() {
}
}
func initLogLevel(cmd *cobra.Command, args []string){
func initLogLevel(cmd *cobra.Command, args []string) {
if logLevel != "" {
glog.SetLevelFromString(logLevel)
}
@ -69,4 +69,4 @@ func init() {
RootCmd.PersistentFlags().StringVarP(&cfgFile, "config", "c", "", "config file ")
RootCmd.PersistentFlags().BoolVarP(&debug, "debug", "d", false, "Enable Debuging")
RootCmd.PersistentFlags().StringVar(&logLevel, "logLevel", "", "Set the Log Level")
}
}

2
pod/main.go

@ -1,3 +1 @@
package pod

22
webapp/manage.py

@ -1,22 +0,0 @@
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "webapp.settings")
try:
from django.core.management import execute_from_command_line
except ImportError:
# The above import may fail for some other reason. Ensure that the
# issue is really that Django is missing to avoid masking other
# exceptions on Python 2.
try:
import django
except ImportError:
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?"
)
raise
execute_from_command_line(sys.argv)

7
webapp/webapp/__init__.py

@ -1,7 +0,0 @@
from __future__ import absolute_import, unicode_literals
# This will make sure the app is always imported when
# Django starts so that shared_task will use this app.
from .celery import app as celery_app
__all__ = ['celery_app']

22
webapp/webapp/celery.py

@ -1,22 +0,0 @@
from __future__ import absolute_import, unicode_literals
import os
from celery import Celery
# set the default Django settings module for the 'celery' program.
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'webapp.settings')
app = Celery('opencloud')
# Using a string here means the worker don't have to serialize
# the configuration object to child processes.
# - namespace='CELERY' means all celery-related configuration keys
# should have a `CELERY_` prefix.
app.config_from_object('django.conf:settings', namespace='CELERY')
# Load task modules from all registered Django app configs.
app.autodiscover_tasks()
@app.task(bind=True)
def debug_task(self):
print('Request: {0!r}'.format(self.request))

137
webapp/webapp/settings.py

@ -1,137 +0,0 @@
"""
Django settings for webapp project.
Generated by 'django-admin startproject' using Django 1.10.3.
For more information on this file, see
https://docs.djangoproject.com/en/1.10/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.10/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.10/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '3!((u1#d^zi0u(o9__mm3#_teh!wv4zdt8l2+#^8#dukafn(e5'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
ALLOWED_HOSTS = []
# Application definition
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'guardian',
'rest_framework',
'opcbase.apps.OpcbaseConfig',
]
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]
ROOT_URLCONF = 'webapp.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [
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 = 'webapp.wsgi.application'
# Database
# https://docs.djangoproject.com/en/1.10/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.10/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.10/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.10/howto/static-files/
STATIC_URL = '/static/'
REST_FRAMEWORK = {
# Use Django's standard `django.contrib.auth` permissions,
# or allow read-only access for unauthenticated users.
'DEFAULT_PERMISSION_CLASSES': [
'rest_framework.permissions.DjangoObjectPermissions'
],
'DEFAULT_VERSIONING_CLASS': 'rest_framework.versioning.AcceptHeaderVersioning',
'DEFAULT_VERSION': '1.0'
}
AUTHENTICATION_BACKENDS = (
'django.contrib.auth.backends.ModelBackend', # default
'guardian.backends.ObjectPermissionBackend',
)
MEDIA_ROOT = BASE_DIR + '/files/'
MEDIA_URL = '/files/'

23
webapp/webapp/urls.py

@ -1,23 +0,0 @@
"""webapp URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.10/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 import settings
from django.conf.urls import url, include
from django.conf.urls.static import static
urlpatterns = [
url(r'', include('opcbase.urls')),
url(r'^api-auth/', include('rest_framework.urls', namespace='rest_framework')),
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

16
webapp/webapp/wsgi.py

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

0
webapp/opcbase/__init__.py → webapp_old/opcbase/__init__.py

0
webapp/opcbase/admin.py → webapp_old/opcbase/admin.py

0
webapp/opcbase/apps.py → webapp_old/opcbase/apps.py

0
webapp/opcbase/fixtures/users.json → webapp_old/opcbase/fixtures/users.json

0
webapp/opcbase/migrations/0001_initial.py → webapp_old/opcbase/migrations/0001_initial.py

0
webapp/opcbase/migrations/0002_auto_20161130_1655.py → webapp_old/opcbase/migrations/0002_auto_20161130_1655.py

0
webapp/opcbase/migrations/0003_auto_20161202_1111.py → webapp_old/opcbase/migrations/0003_auto_20161202_1111.py

0
webapp/opcbase/migrations/__init__.py → webapp_old/opcbase/migrations/__init__.py

0
webapp/opcbase/models.py → webapp_old/opcbase/models.py

0
webapp/opcbase/permissions.py → webapp_old/opcbase/permissions.py

0
webapp/opcbase/serializers.py → webapp_old/opcbase/serializers.py

0
webapp/opcbase/tasks.py → webapp_old/opcbase/tasks.py

0
webapp/opcbase/templates/index.html → webapp_old/opcbase/templates/index.html

0
webapp/opcbase/tests.py → webapp_old/opcbase/tests.py

0
webapp/opcbase/urls.py → webapp_old/opcbase/urls.py

0
webapp/opcbase/views.py → webapp_old/opcbase/views.py

0
webapp/opcwebhosting/__init__.py → webapp_old/opcwebhosting/__init__.py

0
webapp/opcwebhosting/admin.py → webapp_old/opcwebhosting/admin.py

0
webapp/opcwebhosting/apps.py → webapp_old/opcwebhosting/apps.py

0
webapp/opcwebhosting/migrations/__init__.py → webapp_old/opcwebhosting/migrations/__init__.py

0
webapp/opcwebhosting/models.py → webapp_old/opcwebhosting/models.py

0
webapp/opcwebhosting/tests.py → webapp_old/opcwebhosting/tests.py

0
webapp/opcwebhosting/views.py → webapp_old/opcwebhosting/views.py

Loading…
Cancel
Save