2016-09-29 9 views
0

Entwickeln ein eckiges Frontend und Django Backend app.Ich weiß nicht, wo ich falsch liege, aber Django scheint nicht zu finden, die Vorlage und zeigt eine Vorlage nicht vorhanden message.The Projektverzeichnis sieht aus wie this.The Backend-Server ist in der "django Projekt" -OrdnerVorlage existiert nicht Fehler in Django

project directory

base.py (Einstellungen)

import environ 

project_root = environ.Path(__file__) - 3 
env = environ.Env(DEBUG=(bool, False),) 
CURRENT_ENV = 'dev' # 'dev' is the default environment 

# read the .env file associated with the settings that're loaded 
env.read_env('./mysite/{}.env'.format(CURRENT_ENV)) 

#Database 
DATABASES = { 
'default': env.db() 
} 



SECRET_KEY = env('SECRET_KEY') 
DEBUG = env('DEBUG') 

INSTALLED_APPS = [ 
'django.contrib.admin', 
'django.contrib.auth', 
'django.contrib.contenttypes', 
'django.contrib.sessions', 
'django.contrib.messages', 
'django.contrib.staticfiles', 

# Django Packages 
'rest_framework', 
'mysite.applications.games', 


] 




ROOT_URLCONF = 'mysite.urls' 

STATIC_URL = '/static/' 
STATICFILES_FINDERS = [ 
'django.contrib.staticfiles.finders.FileSystemFinder', 
'django.contrib.staticfiles.finders.AppDirectoriesFinder', 
] 
STATICFILES_DIRS = [ 
env('FRONTEND_ROOT') 
] 


TEMPLATES = [ 
{ 
    'BACKEND': 'django.template.backends.django.DjangoTemplates', 
    'DIRS': [env('FRONTEND_ROOT')], 
    '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', 
     ], 
    }, 
}, 
] 

Umgebungsvariablen-Datei (dev.env)

DATABASE_URL=sqlite:///mysite.db 
DEBUG=True 
FRONTEND_ROOT= ('C:/downloads/mysite/frontend/') 
SECRET_KEY= '##########################' 

urls.py

from django.contrib import admin 
from django.conf.urls import include, url 
from mysite.applications.api.v1.routes import api_router 
from django.views.generic import TemplateView 



urlpatterns = [ 
url(r'^admin/', admin.site.urls), 

# Web App Entry 
url(r'^$', TemplateView.as_view(template_name="/app/index.html"), name='index'), 
] 
+0

Wo ist Ihr Vorlagenverzeichnis? Sie haben nicht die Datei /app/index.html, so dass ich nicht weiß, was Sie sonst noch erwarten können: – sebb

+0

Die Vorlage DIRS-Einstellungspunkte auf FRONTEND_ROOT in der Datei dev.env, daher ist FRONTEND_ROOT das Vorlagenverzeichnis. –

+0

Die Datei /app/index.html existiert innerhalb des Frontend-Ordners im Hauptprojektordner. –

Antwort

0

Ich änderte Vorlage DIRS bis zum Punkt Einstellung 'C:/downloads/mysite/Frontend /' und auch der Template-Name auf "/app/index.html" Punkt .app ist ein Ordner im Frontend.