django不提供角度js文件

时间:2016-10-31 05:34:14

标签: javascript angularjs django

我正在尝试使用带角度js的django但是在尝试包含角度js文件时会抛出错误

{% load staticfiles %}

<html ng-app>
    <head>
        <script  type="text/javascript" src="{% static 'js/libs/angular.min.js' %}"></script>
        <script  type="text/javascript" src="{% static 'js/modules/app.module.js' %}"></script>
        <script  type="text/javascript" src="{% static 'js/modules/app.config.js' %}"></script>
        <script  type="text/javascript" src="{% static 'js/modules/blog-list.module.js' %}"></script>
        <script  type="text/javascript" src="{% static 'js/controllers/blog-list.js' %}"></script>
    </head>

    <body>
        <input type="text" ng-model="name">
        <p>hi , {{name}}</p>

        <div ng-controller="BlogListController">
            <h1>{{title}}</h1>
            <button ng-click="someTest()">click</button>
        </div>
    </body>
</html>

这是settings.py

"""
Django settings for trueguild project.

Generated by 'django-admin startproject' using Django 1.8.

For more information on this file, see
https://docs.djangoproject.com/en/1.8/topics/settings/

For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.8/ref/settings/
"""

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import os
import datetime
from django.conf.global_settings import TEMPLATE_CONTEXT_PROCESSORS
from django.core.urlresolvers import reverse_lazy


BASE_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
#root of project

# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.8/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'csqwlmc8s55o($rt6ozh7u+ui9zb-et00w$d90j8$^!nvj41_r'

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

ALLOWED_HOSTS = []

AUTH_USER_MODEL = 'accounts.MyUser'
AUTH_PROFILE_MODULE = 'accounts.UserProfile'



INSTALLED_APPS = (
    #django app
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.admin',
    'django.contrib.sessions',
    'django.contrib.sites',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    #third party apps
    'mptt',
    'debug_toolbar',
    'endless_pagination',
    'rest_framework',
    'allauth',
    'allauth.account',
    'allauth.socialaccount',
    'allauth.socialaccount.providers.amazon',
    'allauth.socialaccount.providers.bitbucket',
    'allauth.socialaccount.providers.dropbox',
    'allauth.socialaccount.providers.facebook',
    'allauth.socialaccount.providers.github',
    'allauth.socialaccount.providers.google',
    'allauth.socialaccount.providers.instagram',
    'allauth.socialaccount.providers.linkedin',
    'allauth.socialaccount.providers.linkedin_oauth2',
    'allauth.socialaccount.providers.stackexchange',
    'allauth.socialaccount.providers.tumblr',
    'allauth.socialaccount.providers.twitter',
    #my apps
    'products' ,
    'likes' ,
    'accounts',
    'analytics',
    'store' ,
    'billing',
    'carts' ,
    'orders' ,
    'notifications',
    'sellers',
    'dataentry',
    'management',
    'coupons',
    'sales',
    # 'Transactions',
)

SITE_ID = 1
LOGIN_REDIRECT_URL = '/'

SOCIALACCOUNT_PROVIDERS = \
    {'facebook':
       {'METHOD': 'oauth2',
        'SCOPE': ['email', 'public_profile', 'user_friends'],
        'AUTH_PARAMS': {'auth_type': 'reauthenticate'},
        'FIELDS': [
            'id',
            'email',
            'name',
            'first_name',
            'last_name',
            'verified',
            'locale',
            'timezone',
            'link',
            'gender',
            'updated_time'],
        'EXCHANGE_TOKEN': True,
        'VERIFIED_EMAIL': False,
        'VERSION': 'v2.4'}}


ACCOUNT_AUTHENTICATION_METHOD = 'username_email' 
ACCOUNT_CONFIRM_EMAIL_ON_GET = False
ACCOUNT_EMAIL_CONFIRMATION_AUTHENTICATED_REDIRECT_URL = LOGIN_REDIRECT_URL
ACCOUNT_EMAIL_CONFIRMATION_EXPIRE_DAYS = 10 
ACCOUNT_EMAIL_REQUIRED = True
ACCOUNT_EMAIL_VERIFICATION = None
ACCOUNT_EMAIL_SUBJECT_PREFIX = 'Subject is'
ACCOUNT_DEFAULT_HTTP_PROTOCOL = 'http'
ACCOUNT_LOGOUT_ON_GET =True
ACCOUNT_UNIQUE_EMAIL = True
ACCOUNT_USER_MODEL_USERNAME_FIELD = 'username'
ACCOUNT_USER_MODEL_EMAIL_FIELD = 'email' 
ACCOUNT_USERNAME_MIN_LENGTH = 4
ACCOUNT_USERNAME_BLACKLIST = []
ACCOUNT_USERNAME_REQUIRED = True
ACCOUNT_PASSWORD_INPUT_RENDER_VALUE = False
ACCOUNT_PASSWORD_MIN_LENGTH =6
ACCOUNT_LOGIN_ON_EMAIL_CONFIRMATION = True
ACCOUNT_SIGNUP_FORM_CLASS = 'accounts.forms.SignupForm'


MIDDLEWARE_CLASSES = (
    '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',
    'django.middleware.security.SecurityMiddleware',
    'debug_toolbar.middleware.DebugToolbarMiddleware',

)


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',
                'django.core.context_processors.request',

            ],
        },
    },
]


AUTHENTICATION_BACKENDS = (
    'django.contrib.auth.backends.ModelBackend',
    'allauth.account.auth_backends.AuthenticationBackend',

)

WSGI_APPLICATION = 'trueguild.wsgi.application'


# Database
# https://docs.djangoproject.com/en/1.8/ref/settings/#databases
#django.db.backends.mysql

DATABASES = {
    'default': {
        'ENGINE': 'mysql_cymysql', 
        'NAME': 'trueguild',
        'USER': 'root',
        'PASSWORD': 'root',
        'HOST': 'localhost',   # Or an IP Address that your DB is hosted on
        'PORT': '3306',
    }
}


# Internationalization
# https://docs.djangoproject.com/en/1.8/topics/i18n/

LANGUAGE_CODE = 'en-us'

TIME_ZONE = 'Asia/Kolkata'

USE_I18N = True

USE_L10N = True

USE_TZ = True


# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.8/howto/static-files/

STATIC_ROOT = os.path.join(BASE_DIR, 'static')

STATIC_URL = '/static/'

# STATICFILES_DIRS = (
#     os.path.join(BASE_DIR, "static_files"),
#     #os.path.join(BASE_DIR, "static_in_env"),
#     #'/var/www/static/',
# )

MEDIA_URL = '/media/'

MEDIA_ROOT = os.path.join(os.path.dirname(BASE_DIR), "media_root")


ROOT_URLCONF = 'trueguild.urls'

#Crispy FORM TAGs SETTINGS
CRISPY_TEMPLATE_PACK = 'bootstrap3'


#DJANGO REGISTRATION REDUX SETTINGS
ACCOUNT_ACTIVATION_DAYS = 7
REGISTRATION_AUTO_LOGIN = True


TEMPLATE_DIRS = (os.path.join(BASE_DIR, 'templates'),)



SESSION_EXPIRE_AT_BROWSER_CLOSE = False

INTERNAL_IPS = '139.59.17.17'

DEBUG_TOOLBAR_PATCH_SETTINGS = False

WHOOSH_INDEX = os.path.join(BASE_DIR, 'whoosh')

HAYSTACK_CONNECTIONS = {
    'default': {
        'ENGINE': 'haystack.backends.whoosh_backend.WhooshEngine',
        'PATH': WHOOSH_INDEX ,
    },
}

REST_FRAMEWORK = {
    'DEFAULT_PERMISSIONS_CLASSES' : {
     'rest_framework.permissions.AllowAny',
    },
}


JWT_AUTH = {
 "JWT_RESPONSE_PAYLOAD_HANDLER" : "trueguild.utils.jwt_response_payload_handler",
 "JWT_EXPIRATION_DELTA" : datetime.timedelta(seconds=30000),
 "JWT_ALLOW_REFRESH" : True
}

SOCIALACCOUNT_ADAPTER ="orders.adapters.MySocialAccountAdapter"
  

Django服务器抛出404错误虽然该文件存在于   位置

我如何服务角度js文件。提前谢谢

0 个答案:

没有答案