integrate vue cateditor with django

This commit is contained in:
Seth Ladygo
2019-04-01 17:11:11 -07:00
parent 4e99dcd1e0
commit e50258b405
3 changed files with 63 additions and 8 deletions

View File

@ -16,6 +16,8 @@ from django.urls import reverse_lazy
# Build paths inside the project like this: os.path.join(BASE_DIR, ...) # Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
TEMPLATES_DIR = os.path.join(BASE_DIR, 'templates')
FRONTEND_DIR = os.path.join(BASE_DIR, 'cateditor')
# Quick-start development settings - unsuitable for production # Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/2.1/howto/deployment/checklist/ # See https://docs.djangoproject.com/en/2.1/howto/deployment/checklist/
@ -73,6 +75,7 @@ INSTALLED_APPS = [
'django_extensions', 'django_extensions',
'account', 'account',
'lazysignup', 'lazysignup',
'webpack_loader',
'procat2', 'procat2',
'dashboard', 'dashboard',
] ]
@ -148,8 +151,10 @@ USE_TZ = True
# Static files (CSS, JavaScript, Images) # Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/2.1/howto/static-files/ # https://docs.djangoproject.com/en/2.1/howto/static-files/
STATIC_URL = '/static/' STATIC_URL = '/static/'
# (STATIC_ROOT set in settings_ansible.py)
STATICFILES_DIRS = [ STATICFILES_DIRS = [
os.path.join(BASE_DIR, "static"), os.path.join(BASE_DIR, "static"),
os.path.join(FRONTEND_DIR, "dist"),
] ]
LOGIN_REDIRECT_URL = reverse_lazy('home') LOGIN_REDIRECT_URL = reverse_lazy('home')
@ -171,10 +176,24 @@ if DJDT:
) )
INTERNAL_IPS = ('127.0.0.1',) INTERNAL_IPS = ('127.0.0.1',)
# bring in ansible-defined settings
from .settings_ansible import *
# what settings to expose in templates # what settings to expose in templates
SETTINGS_EXPORT = [ SETTINGS_EXPORT = [
'CUSTOMER_NAME', 'CUSTOMER_NAME',
] ]
# can have multiple if we have multiple vue pages.
# https://github.com/owais/django-webpack-loader
WEBPACK_LOADER = {
'DEFAULT': {
'CACHE': not DEBUG,
#'BUNDLE_DIR_NAME': '/bundles/', # must end with slash
'BUNDLE_DIR_NAME': '',
# 'POLL_INTERVAL': 0.1,
# 'TIMEOUT': None,
'STATS_FILE': os.path.join(FRONTEND_DIR, 'webpack-stats.json'),
'IGNORE': [r'.+\.hot-update.js', r'.+\.map']
}
}
# bring in ansible-defined settings
from .settings_ansible import *

View File

@ -1,3 +1,5 @@
backcall==0.1.0
decorator==4.4.0
Django==2.1.7 Django==2.1.7
django-appconf==1.0.3 django-appconf==1.0.3
django-debug-toolbar==1.11 django-debug-toolbar==1.11
@ -5,8 +7,21 @@ django-extensions==2.1.6
django-lazysignup==2.0.0 django-lazysignup==2.0.0
django-settings-export==1.2.1 django-settings-export==1.2.1
django-user-accounts==2.1.0 django-user-accounts==2.1.0
django-webpack-loader==0.6.0
ipdb==0.11
ipython==7.3.0
ipython-genutils==0.2.0
jedi==0.13.3
parso==0.3.4
pexpect==4.6.0
pickleshare==0.7.5
prompt-toolkit==2.0.9
psycopg2-binary==2.7.7 psycopg2-binary==2.7.7
ptyprocess==0.6.0
Pygments==2.3.1
pytz==2018.9 pytz==2018.9
six==1.12.0 six==1.12.0
sqlparse==0.3.0 sqlparse==0.3.0
traitlets==4.3.2
wcwidth==0.1.7
Werkzeug==0.14.1 Werkzeug==0.14.1

View File

@ -1,8 +1,29 @@
{% extends 'base.html' %} {% load staticfiles %}
{% load staticfiles i18n %} {% load render_bundle from webpack_loader %}
{% block title %}{% trans "Editor"%}{% endblock %} <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link href="{% static 'img/favicon.ico' %}" rel="shortcut icon" />
<title>Django Vue Integration</title>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700,900">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Material+Icons">
</head>
<body>
<noscript>
<strong>We're sorry but frontend doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
</noscript>
{% block content %} <div id="app">
<app></app>
</div>
{% endblock %} {% render_bundle 'app' %}
<!-- built files will be auto injected -->
</body>
</html>