├── tasks
├── __init__.py
├── migrations
│ ├── __init__.py
│ └── 0001_initial.py
├── tests.py
├── admin.py
├── views.py
├── apps.py
├── models.py
├── fixtures
│ └── tasks.json
└── schema.py
├── myproject
├── __init__.py
├── settings
│ ├── __init__.py
│ ├── prod.py
│ ├── dev.py
│ └── settings.py
├── schema.py
├── wsgi.py
└── urls.py
├── frontend
├── .browserslistrc
├── babel.config.js
├── postcss.config.js
├── public
│ ├── favicon.ico
│ └── index.html
├── src
│ ├── assets
│ │ ├── logo.png
│ │ └── logo.1.png
│ ├── views
│ │ ├── About.vue
│ │ └── Home.vue
│ ├── store.js
│ ├── main.js
│ ├── App.vue
│ ├── router.js
│ ├── vue-apollo.js
│ └── components
│ │ └── HelloWorld.vue
├── README.md
├── .gitignore
├── .eslintrc.js
├── package.json
└── vue.config.js
├── static
└── favicon.ico
├── README.md
├── Pipfile
├── run.sh
├── .gitignore
├── manage.py
├── templates
└── index.html
├── LICENSE
└── Pipfile.lock
/tasks/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/myproject/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/tasks/migrations/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/myproject/settings/__init__.py:
--------------------------------------------------------------------------------
1 | from .dev import *
--------------------------------------------------------------------------------
/frontend/.browserslistrc:
--------------------------------------------------------------------------------
1 | > 1%
2 | last 2 versions
3 | not ie <= 8
4 |
--------------------------------------------------------------------------------
/tasks/tests.py:
--------------------------------------------------------------------------------
1 | from django.test import TestCase
2 |
3 | # Create your tests here.
4 |
--------------------------------------------------------------------------------
/tasks/admin.py:
--------------------------------------------------------------------------------
1 | from django.contrib import admin
2 |
3 | # Register your models here.
4 |
--------------------------------------------------------------------------------
/tasks/views.py:
--------------------------------------------------------------------------------
1 | from django.shortcuts import render
2 |
3 | # Create your views here.
4 |
--------------------------------------------------------------------------------
/frontend/babel.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | presets: [
3 | '@vue/app'
4 | ]
5 | }
6 |
--------------------------------------------------------------------------------
/static/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alexiej/django-vue-graphql/HEAD/static/favicon.ico
--------------------------------------------------------------------------------
/frontend/postcss.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | plugins: {
3 | autoprefixer: {}
4 | }
5 | }
6 |
--------------------------------------------------------------------------------
/frontend/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alexiej/django-vue-graphql/HEAD/frontend/public/favicon.ico
--------------------------------------------------------------------------------
/frontend/src/assets/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alexiej/django-vue-graphql/HEAD/frontend/src/assets/logo.png
--------------------------------------------------------------------------------
/tasks/apps.py:
--------------------------------------------------------------------------------
1 | from django.apps import AppConfig
2 |
3 |
4 | class TasksConfig(AppConfig):
5 | name = 'tasks'
6 |
--------------------------------------------------------------------------------
/frontend/src/assets/logo.1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alexiej/django-vue-graphql/HEAD/frontend/src/assets/logo.1.png
--------------------------------------------------------------------------------
/frontend/src/views/About.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
This is an about page
4 |
5 |
6 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # django-vue-graphql
2 | django-vue-graphql
3 |
4 |
5 | All steps to create this project can be found in the: [https://alexiej.github.io/django-vue-graphql/index.html](https://alexiej.github.io/django-vue-graphql/index.html)
6 |
--------------------------------------------------------------------------------
/frontend/src/store.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue'
2 | import Vuex from 'vuex'
3 |
4 | Vue.use(Vuex)
5 |
6 | export default new Vuex.Store({
7 | state: {
8 |
9 | },
10 | mutations: {
11 |
12 | },
13 | actions: {
14 |
15 | }
16 | })
17 |
--------------------------------------------------------------------------------
/Pipfile:
--------------------------------------------------------------------------------
1 | [[source]]
2 | url = "https://pypi.org/simple"
3 | verify_ssl = true
4 | name = "pypi"
5 |
6 | [packages]
7 | django = "*"
8 | django-debug-toolbar = "*"
9 | django-webpack-loader = "*"
10 | graphene-django = "*"
11 | django-filter = "==1.1.0"
12 |
13 | [dev-packages]
14 |
15 | [requires]
16 | python_version = "3.6"
17 |
--------------------------------------------------------------------------------
/frontend/README.md:
--------------------------------------------------------------------------------
1 | # frontend
2 |
3 | ## Project setup
4 | ```
5 | yarn install
6 | ```
7 |
8 | ### Compiles and hot-reloads for development
9 | ```
10 | yarn run serve
11 | ```
12 |
13 | ### Compiles and minifies for production
14 | ```
15 | yarn run build
16 | ```
17 |
18 | ### Lints and fixes files
19 | ```
20 | yarn run lint
21 | ```
22 |
--------------------------------------------------------------------------------
/frontend/src/main.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue'
2 | import App from './App.vue'
3 | import router from './router'
4 | import store from './store'
5 | import apolloProvider from './vue-apollo'
6 |
7 | Vue.config.productionTip = false
8 |
9 | new Vue({
10 | router,
11 | store,
12 | apolloProvider: apolloProvider,
13 | render: h => h(App)
14 | }).$mount('#app')
--------------------------------------------------------------------------------
/run.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | pipenv shell
3 |
4 | case $1 in
5 | dev)
6 | python manage.py runserver --settings=myproject.settings.dev
7 | ;;
8 | prod)
9 | python manage.py collectstatic --noinput
10 | python manage.py makemigrations
11 | python manage.py migrate
12 | python manage.py runserver --settings=myproject.settings.prod
13 | ;;
14 | esac
--------------------------------------------------------------------------------
/myproject/schema.py:
--------------------------------------------------------------------------------
1 | import graphene
2 | import tasks.schema
3 |
4 | class Query(tasks.schema.Query, graphene.ObjectType):
5 | # This class will inherit from multiple Queries
6 | # as we begin to add more apps to our project
7 | pass
8 |
9 | class Mutation(tasks.schema.Mutations, graphene.ObjectType):
10 | pass
11 |
12 | schema = graphene.Schema(query=Query, mutation=Mutation)
--------------------------------------------------------------------------------
/frontend/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | node_modules
3 | dist
4 | static
5 |
6 | # local env files
7 | .env.local
8 | .env.*.local
9 |
10 | # Log files
11 | npm-debug.log*
12 | yarn-debug.log*
13 | yarn-error.log*
14 |
15 | webpack-stats.json
16 | webpack-stats-prod.json
17 |
18 | # Editor directories and files
19 | .idea
20 | .vscode
21 | *.suo
22 | *.ntvs*
23 | *.njsproj
24 | *.sln
25 | *.sw*
26 |
--------------------------------------------------------------------------------
/tasks/models.py:
--------------------------------------------------------------------------------
1 | from django.db import models
2 | from django.contrib import admin
3 |
4 | # Create your models here.
5 |
6 | class Task(models.Model):
7 | isDone = models.BooleanField()
8 | name = models.CharField(max_length=100)
9 | description = models.TextField()
10 |
11 | def __str__(self):
12 | return self.name
13 |
14 |
15 | @admin.register(Task)
16 | class TaskAdmin(admin.ModelAdmin):
17 | pass
--------------------------------------------------------------------------------
/frontend/.eslintrc.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | root: true,
3 | env: {
4 | node: true
5 | },
6 | 'extends': [
7 | 'plugin:vue/essential',
8 | 'eslint:recommended'
9 | ],
10 | rules: {
11 | 'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off',
12 | 'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off'
13 | },
14 | parserOptions: {
15 | parser: 'babel-eslint'
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/myproject/wsgi.py:
--------------------------------------------------------------------------------
1 | """
2 | WSGI config for myproject project.
3 |
4 | It exposes the WSGI callable as a module-level variable named ``application``.
5 |
6 | For more information on this file, see
7 | https://docs.djangoproject.com/en/2.1/howto/deployment/wsgi/
8 | """
9 |
10 | import os
11 |
12 | from django.core.wsgi import get_wsgi_application
13 |
14 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'myproject.settings')
15 |
16 | application = get_wsgi_application()
17 |
--------------------------------------------------------------------------------
/tasks/fixtures/tasks.json:
--------------------------------------------------------------------------------
1 | [{
2 | "model": "tasks.Task",
3 | "pk": 1,
4 | "fields": {
5 | "isDone": "True",
6 | "name": "Do shoppping",
7 | "description": "milk, butter"
8 | }
9 | }, {
10 | "model": "tasks.Task",
11 | "pk": 2,
12 | "fields": {
13 | "isDone": "False",
14 | "name": "Do laundry",
15 | "description": "all clothes"
16 | }
17 | }, {
18 | "model": "tasks.Task",
19 | "pk": 3,
20 | "fields": {
21 | "isDone": "False",
22 | "name": "Fix computer",
23 | "description": "Fix computer"
24 | }
25 | }]
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | node_modules
3 | /dist
4 | staticfiles
5 | db.sqlite3
6 |
7 | *.egg-info
8 | *.pot
9 | *.py[co]
10 | *.pyc
11 | .tox/
12 | __pycache__
13 | MANIFEST
14 | dist/
15 | docs/_build/
16 | docs/locale/
17 | node_modules/
18 | tests/coverage_html/
19 | tests/.coverage
20 | build/
21 | tests/report/
22 | staticfiles/
23 |
24 | # local env files
25 | .env.local
26 | .env.*.local
27 |
28 | # Log files
29 | npm-debug.log*
30 | yarn-debug.log*
31 | yarn-error.log*
32 |
33 | # Editor directories and files
34 | .idea
35 | .vscode
36 | *.suo
37 | *.ntvs*
38 | *.njsproj
39 | *.sln
40 | *.sw*
41 |
--------------------------------------------------------------------------------
/manage.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | import os
3 | import sys
4 |
5 | if __name__ == '__main__':
6 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'myproject.settings')
7 | try:
8 | from django.core.management import execute_from_command_line
9 | except ImportError as exc:
10 | raise ImportError(
11 | "Couldn't import Django. Are you sure it's installed and "
12 | "available on your PYTHONPATH environment variable? Did you "
13 | "forget to activate a virtual environment?"
14 | ) from exc
15 | execute_from_command_line(sys.argv)
16 |
--------------------------------------------------------------------------------
/myproject/settings/prod.py:
--------------------------------------------------------------------------------
1 | from .settings import *
2 | import os
3 |
4 | DEBUG = False
5 | ALLOWED_HOSTS = ['*']
6 |
7 | WEBPACK_LOADER = {
8 | 'DEFAULT': {
9 | 'BUNDLE_DIR_NAME': '',
10 | 'STATS_FILE': os.path.join(BASE_DIR, 'frontend/webpack-stats-prod.json'),
11 | }
12 | }
13 |
14 | STATICFILES_DIRS = [
15 | os.path.join(BASE_DIR, "static"),
16 | ]
17 |
18 | MEDIA_URL = '/dmedia/'
19 | MEDIA_ROOT = os.path.join(BASE_DIR, "mediafiles")
20 |
21 | STATIC_URL = '/static/'
22 | STATIC_ROOT = os.path.join(BASE_DIR, "staticfiles")
23 |
24 | VUE_ROOT = os.path.join(BASE_DIR, "frontend\\dist\\")
--------------------------------------------------------------------------------
/frontend/public/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | frontend
9 |
10 |
11 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/frontend/src/App.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Home |
5 | About
6 |
7 |
8 |
9 |
10 |
11 |
30 |
--------------------------------------------------------------------------------
/frontend/src/router.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue'
2 | import Router from 'vue-router'
3 | import Home from './views/Home.vue'
4 |
5 | Vue.use(Router)
6 |
7 | export default new Router({
8 | mode: 'history',
9 | base: process.env.BASE_URL,
10 | routes: [
11 | {
12 | path: '/',
13 | name: 'home',
14 | component: Home
15 | },
16 | {
17 | path: '/about',
18 | name: 'about',
19 | // route level code-splitting
20 | // this generates a separate chunk (about.[hash].js) for this route
21 | // which is lazy-loaded when the route is visited.
22 | component: () => import(/* webpackChunkName: "about" */ './views/About.vue')
23 | }
24 | ]
25 | })
26 |
--------------------------------------------------------------------------------
/tasks/migrations/0001_initial.py:
--------------------------------------------------------------------------------
1 | # Generated by Django 2.1.1 on 2018-09-03 11:16
2 |
3 | from django.db import migrations, models
4 |
5 |
6 | class Migration(migrations.Migration):
7 |
8 | initial = True
9 |
10 | dependencies = [
11 | ]
12 |
13 | operations = [
14 | migrations.CreateModel(
15 | name='Task',
16 | fields=[
17 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
18 | ('isDone', models.BooleanField()),
19 | ('name', models.CharField(max_length=100)),
20 | ('description', models.TextField()),
21 | ],
22 | ),
23 | ]
24 |
--------------------------------------------------------------------------------
/frontend/src/vue-apollo.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue'
2 | import { ApolloClient } from 'apollo-client'
3 | import { HttpLink } from 'apollo-link-http'
4 | import { InMemoryCache } from 'apollo-cache-inmemory'
5 | import VueApollo from 'vue-apollo'
6 |
7 | const httpLink = new HttpLink({
8 | // You should use an absolute URL here
9 | uri: '/graphql',
10 | })
11 |
12 | // Create the apollo client
13 | const apolloClient = new ApolloClient({
14 | link: httpLink,
15 | cache: new InMemoryCache(),
16 | connectToDevTools: true,
17 | })
18 |
19 | const apolloProvider = new VueApollo({
20 | defaultClient: apolloClient,
21 | })
22 |
23 | // Install the vue plugin
24 | Vue.use(VueApollo)
25 |
26 | export default apolloProvider
--------------------------------------------------------------------------------
/myproject/settings/dev.py:
--------------------------------------------------------------------------------
1 | from .settings import *
2 |
3 | DEBUG = True
4 | ALLOWED_HOSTS = ['*']
5 |
6 | MIDDLEWARE.append('debug_toolbar.middleware.DebugToolbarMiddleware')
7 | INSTALLED_APPS.append('debug_toolbar')
8 | INTERNAL_IPS = ('127.0.0.1', 'localhost')
9 |
10 | WEBPACK_LOADER = {
11 | 'DEFAULT': {
12 | 'BUNDLE_DIR_NAME': '',
13 | 'STATS_FILE': os.path.join(BASE_DIR, 'frontend/webpack-stats.json'),
14 | }
15 | }
16 |
17 | STATICFILES_DIRS = [
18 | os.path.join(BASE_DIR, "static"),
19 | ]
20 | MEDIA_URL = '/dmedia/'
21 | MEDIA_ROOT = os.path.join(BASE_DIR, "mediafiles")
22 |
23 | STATIC_URL = '/static/'
24 | STATIC_ROOT = os.path.join(BASE_DIR, "staticfiles")
25 |
26 | VUE_ROOT = os.path.join(BASE_DIR, "frontend\\static\\")
--------------------------------------------------------------------------------
/templates/index.html:
--------------------------------------------------------------------------------
1 | {% load render_bundle from webpack_loader %}
2 | {% load static from staticfiles %}
3 |
4 |
5 |
6 |
7 |
8 |
9 | frontend
10 |
11 |
12 | {% render_bundle 'chunk-vendors' %}
13 |
14 |
15 |
18 |
19 | {% for i in 'abc' %}
20 | {{ i }} DJANGO PART
21 | {% endfor %}
22 |
23 |
24 |
25 | {% render_bundle 'app' %}
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/frontend/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "frontend",
3 | "version": "0.1.0",
4 | "private": true,
5 | "scripts": {
6 | "serve": "vue-cli-service serve",
7 | "build": "vue-cli-service build",
8 | "lint": "vue-cli-service lint"
9 | },
10 | "dependencies": {
11 | "apollo-cache-inmemory": "^1.2.9",
12 | "apollo-client": "^2.4.1",
13 | "apollo-link": "^1.2.2",
14 | "apollo-link-http": "^1.5.4",
15 | "graphql": "^14.0.0",
16 | "graphql-tag": "^2.9.2",
17 | "vue": "^2.5.17",
18 | "vue-apollo": "^3.0.0-beta.21",
19 | "vue-router": "^3.0.1",
20 | "vuex": "^3.0.1",
21 | "webpack-bundle-tracker": "^0.3.0"
22 | },
23 | "devDependencies": {
24 | "@vue/cli-plugin-babel": "^3.0.1",
25 | "@vue/cli-plugin-eslint": "^3.0.1",
26 | "@vue/cli-service": "^3.0.1",
27 | "node-sass": "^4.9.0",
28 | "sass-loader": "^7.0.1",
29 | "vue-template-compiler": "^2.5.17",
30 | "write-file-webpack-plugin": "^4.3.2"
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2018 arek
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/tasks/schema.py:
--------------------------------------------------------------------------------
1 | # myproject/tasks/schema.py
2 | import graphene
3 | from graphene_django.types import DjangoObjectType
4 | from graphql_relay.node.node import from_global_id
5 | from tasks.models import Task
6 |
7 |
8 | class TaskType(DjangoObjectType):
9 | class Meta:
10 | model = Task
11 |
12 | class CreateTask(graphene.Mutation):
13 | ok = graphene.Boolean()
14 | task = graphene.Field(lambda: TaskType)
15 |
16 | class Arguments:
17 | name = graphene.String()
18 | description = graphene.String()
19 |
20 | def mutate(self, info, name, description):
21 | task = Task(name = name, description = description, isDone = False)
22 | task.save()
23 | ok = True
24 | return CreateTask(task=task,ok=ok)
25 |
26 | class UpdateTask(graphene.Mutation):
27 | task = graphene.Field(lambda: TaskType)
28 | ok = graphene.Boolean()
29 |
30 | class Arguments:
31 | id = graphene.String()
32 | IsDone = graphene.Boolean()
33 |
34 | def mutate(self, info, id, IsDone):
35 | task = Task.objects.get(pk=id)
36 | task.isDone = IsDone
37 | task.save()
38 | ok = True
39 | return UpdateTask(task=task,ok=ok)
40 |
41 |
42 | class Query(graphene.ObjectType):
43 | tasks = graphene.List(TaskType)
44 |
45 | def resolve_tasks(self, info):
46 | return Task.objects.all()
47 |
48 |
49 | class Mutations(graphene.ObjectType):
50 | create_task = CreateTask.Field()
51 | update_task = UpdateTask.Field()
--------------------------------------------------------------------------------
/frontend/vue.config.js:
--------------------------------------------------------------------------------
1 | var BundleTracker = require('webpack-bundle-tracker')
2 | var WriteFilePlugin = require('write-file-webpack-plugin')
3 |
4 |
5 | module.exports = {
6 | outputDir: (process.env.NODE_ENV === "production" ? 'dist' : 'static'),
7 | baseUrl: '/',
8 |
9 | devServer: {
10 | publicPath: "http://localhost:8080/",
11 | headers: {
12 | "Access-Control-Allow-Origin": "*",
13 | "Access-Control-Allow-Methods": "GET, POST, PUT, DELETE, PATCH, OPTIONS",
14 | "Access-Control-Allow-Headers": "Origin, X-Requested-With, Content-Type, Accept, Accept-Encoding, Accept-Language, Access-Control-Request-Headers, Access-Control-Request-Method",
15 | "Access-Control-Allow-Credentials": "true"
16 | }
17 | },
18 |
19 | chainWebpack: config => {
20 | config.optimization.splitChunks({
21 | cacheGroups: {
22 | vendors: {
23 | name: 'chunk-vendors',
24 | test: /[\\\/]node_modules[\\\\/]/,
25 | priority: -10,
26 | chunks: 'initial'
27 | },
28 | common: {
29 | name: 'chunk-common',
30 | minChunks: 2,
31 | priority: -20,
32 | chunks: 'initial',
33 | reuseExistingChunk: true
34 | }
35 | }
36 | })
37 | },
38 | configureWebpack: {
39 | output: {
40 | filename: 'js/[name].js',
41 | chunkFilename: 'js/[name].js'
42 | },
43 | plugins: [
44 | new WriteFilePlugin(),
45 | (process.env.NODE_ENV === "production" ?
46 | new BundleTracker({
47 | filename: 'webpack-stats-prod.json',
48 | publicPath: '/'
49 | }) :
50 | new BundleTracker({
51 | filename: 'webpack-stats.json',
52 | publicPath: 'http://localhost:8080/'
53 | })
54 | )
55 | ]
56 | }
57 | }
--------------------------------------------------------------------------------
/myproject/urls.py:
--------------------------------------------------------------------------------
1 | from django.contrib import admin
2 | from django.urls import path
3 | from django.views.generic import TemplateView
4 | from django.conf import settings
5 | from django.conf.urls import include, url
6 | from django.views.static import serve
7 | from graphene_django.views import GraphQLView
8 | from django.views.decorators.csrf import csrf_exempt
9 | import os
10 |
11 |
12 | from django.views.generic.base import RedirectView
13 | favicon_view = RedirectView.as_view(url=os.path.join(settings.STATIC_URL,'favicon.ico'), permanent=True)
14 |
15 | urlpatterns = [
16 | path('favicon.ico', favicon_view),
17 | path('', TemplateView.as_view(template_name='index.html')),
18 | path('about/', TemplateView.as_view(template_name='index.html')),
19 | url(r'^graphql', csrf_exempt(GraphQLView.as_view(graphiql=True))),
20 | path('admin/', admin.site.urls),
21 |
22 | #DJANGO folders
23 | url(r'^static/(?P.*)$', serve,
24 | {'document_root': settings.STATIC_ROOT}),
25 | url(r'^dmedia/(?P.*)$', serve,
26 | {'document_root': settings.MEDIA_ROOT}),
27 |
28 | #Vue.js folders
29 | url(r'^media/(?P.*)$', serve,
30 | {'document_root': os.path.join(settings.VUE_ROOT, 'media')}),
31 | url(r'^img/(?P.*)$', serve,
32 | {'document_root': os.path.join(settings.VUE_ROOT, 'img')}),
33 | url(r'^js/(?P.*)$', serve,
34 | {'document_root': os.path.join(settings.VUE_ROOT, 'js')}),
35 | url(r'^css/(?P.*)$', serve,
36 | {'document_root': os.path.join(settings.VUE_ROOT, 'css')}),
37 | url(r'^fonts/(?P.*)$', serve,
38 | {'document_root': os.path.join(settings.VUE_ROOT, 'fonts')}),
39 | ]
40 |
41 |
42 | if settings.DEBUG:
43 | import debug_toolbar
44 | urlpatterns = [
45 | url(r'^__debug__/', include(debug_toolbar.urls)),
46 | ] + urlpatterns
--------------------------------------------------------------------------------
/frontend/src/components/HelloWorld.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
{{ msg }}
4 |
5 | For guide and recipes on how to configure / customize this project,
6 | check out the
7 | vue-cli documentation.
8 |
9 |
Installed CLI Plugins
10 |
14 |
Essential Links
15 |
22 |
Ecosystem
23 |
30 |
31 |
32 |
33 |
41 |
42 |
43 |
59 |
--------------------------------------------------------------------------------
/frontend/src/views/Home.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Name:
5 | Description:
6 |
7 |
8 |
9 |
18 |

19 |
20 |
21 |
22 |
23 |
134 |
--------------------------------------------------------------------------------
/myproject/settings/settings.py:
--------------------------------------------------------------------------------
1 | """
2 | Django settings for myproject project.
3 |
4 | Generated by 'django-admin startproject' using Django 2.1.1.
5 |
6 | For more information on this file, see
7 | https://docs.djangoproject.com/en/2.1/topics/settings/
8 |
9 | For the full list of settings and their values, see
10 | https://docs.djangoproject.com/en/2.1/ref/settings/
11 | """
12 |
13 | import os
14 |
15 | # Build paths inside the project like this: os.path.join(BASE_DIR, ...)
16 | BASE_DIR = os.path.dirname(os.path.dirname(
17 | os.path.dirname(os.path.abspath(__file__))))
18 | STATIC_ROOT = os.path.join(BASE_DIR, "staticfiles")
19 |
20 | # Quick-start development settings - unsuitable for production
21 | # See https://docs.djangoproject.com/en/2.1/howto/deployment/checklist/
22 |
23 | # SECURITY WARNING: keep the secret key used in production secret!
24 | SECRET_KEY = 'jr9*w(&2sck)9l$^6s$+2g)!t&t)=4+&6_80==j&9ej!!9l&ls'
25 |
26 | # SECURITY WARNING: don't run with debug turned on in production!
27 | DEBUG = True
28 |
29 | ALLOWED_HOSTS = []
30 |
31 |
32 | # Application definition
33 |
34 | INSTALLED_APPS = [
35 | 'django.contrib.admin',
36 | 'django.contrib.auth',
37 | 'django.contrib.contenttypes',
38 | 'django.contrib.sessions',
39 | 'django.contrib.messages',
40 | 'django.contrib.staticfiles',
41 | 'webpack_loader',
42 | 'graphene_django',
43 | 'tasks',
44 | ]
45 |
46 | GRAPHENE = {
47 | 'SCHEMA': 'myproject.schema.schema'
48 | }
49 |
50 | MIDDLEWARE = [
51 | 'django.middleware.security.SecurityMiddleware',
52 | 'django.contrib.sessions.middleware.SessionMiddleware',
53 | 'django.middleware.common.CommonMiddleware',
54 | 'django.middleware.csrf.CsrfViewMiddleware',
55 | 'django.contrib.auth.middleware.AuthenticationMiddleware',
56 | 'django.contrib.messages.middleware.MessageMiddleware',
57 | 'django.middleware.clickjacking.XFrameOptionsMiddleware',
58 | ]
59 |
60 | ROOT_URLCONF = 'myproject.urls'
61 |
62 | TEMPLATES = [
63 | {
64 | 'BACKEND': 'django.template.backends.django.DjangoTemplates',
65 | 'DIRS': [
66 | os.path.join(BASE_DIR, 'templates'),
67 | ],
68 | 'APP_DIRS': True,
69 | 'OPTIONS': {
70 | 'context_processors': [
71 | 'django.template.context_processors.debug',
72 | 'django.template.context_processors.request',
73 | 'django.contrib.auth.context_processors.auth',
74 | 'django.contrib.messages.context_processors.messages',
75 | ],
76 | },
77 | },
78 | ]
79 |
80 | WSGI_APPLICATION = 'myproject.wsgi.application'
81 |
82 |
83 | # Database
84 | # https://docs.djangoproject.com/en/2.1/ref/settings/#databases
85 |
86 | DATABASES = {
87 | 'default': {
88 | 'ENGINE': 'django.db.backends.sqlite3',
89 | 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
90 | }
91 | }
92 |
93 |
94 | # Password validation
95 | # https://docs.djangoproject.com/en/2.1/ref/settings/#auth-password-validators
96 |
97 | AUTH_PASSWORD_VALIDATORS = [
98 | {
99 | 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
100 | },
101 | {
102 | 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
103 | },
104 | {
105 | 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
106 | },
107 | {
108 | 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
109 | },
110 | ]
111 |
112 |
113 | # Internationalization
114 | # https://docs.djangoproject.com/en/2.1/topics/i18n/
115 |
116 | LANGUAGE_CODE = 'en-us'
117 |
118 | TIME_ZONE = 'UTC'
119 |
120 | USE_I18N = True
121 |
122 | USE_L10N = True
123 |
124 | USE_TZ = True
125 |
126 |
127 | # Static files (CSS, JavaScript, Images)
128 | # https://docs.djangoproject.com/en/2.1/howto/static-files/
129 |
130 | STATIC_URL = '/static/'
131 |
--------------------------------------------------------------------------------
/Pipfile.lock:
--------------------------------------------------------------------------------
1 | {
2 | "_meta": {
3 | "hash": {
4 | "sha256": "e6d06034c34dbb5ab00ec0d94e13f6cdc53ce16d0820534e090507889b932e43"
5 | },
6 | "pipfile-spec": 6,
7 | "requires": {
8 | "python_version": "3.6"
9 | },
10 | "sources": [
11 | {
12 | "name": "pypi",
13 | "url": "https://pypi.org/simple",
14 | "verify_ssl": true
15 | }
16 | ]
17 | },
18 | "default": {
19 | "aniso8601": {
20 | "hashes": [
21 | "sha256:7849749cf00ae0680ad2bdfe4419c7a662bef19c03691a19e008c8b9a5267802",
22 | "sha256:94f90871fcd314a458a3d4eca1c84448efbd200e86f55fe4c733c7a40149ef50"
23 | ],
24 | "version": "==3.0.2"
25 | },
26 | "django": {
27 | "hashes": [
28 | "sha256:04f2e423f2e60943c02bd2959174b844f7d1bcd19eabb7f8e4282999958021fd",
29 | "sha256:e1cc1cd6b658aa4e052f5f2b148bfda08091d7c3558529708342e37e4e33f72c"
30 | ],
31 | "index": "pypi",
32 | "version": "==2.1.1"
33 | },
34 | "django-debug-toolbar": {
35 | "hashes": [
36 | "sha256:4af2a4e1e932dadbda197b18585962d4fc20172b4e5a479490bc659fe998864d",
37 | "sha256:d9ea75659f76d8f1e3eb8f390b47fc5bad0908d949c34a8a3c4c87978eb40a0f"
38 | ],
39 | "index": "pypi",
40 | "version": "==1.9.1"
41 | },
42 | "django-filter": {
43 | "hashes": [
44 | "sha256:ea204242ea83790e1512c9d0d8255002a652a6f4986e93cee664f28955ba0c22",
45 | "sha256:ec0ef1ba23ef95b1620f5d481334413700fb33f45cd76d56a63f4b0b1d76976a"
46 | ],
47 | "index": "pypi",
48 | "version": "==1.1.0"
49 | },
50 | "django-webpack-loader": {
51 | "hashes": [
52 | "sha256:60bab6b9a037a5346fad12d2a70a6bc046afb33154cf75ed640b93d3ebd5f520",
53 | "sha256:970b968c2a8975fb7eff56a3bab5d0d90d396740852d1e0c50c5cfe2b824199a"
54 | ],
55 | "index": "pypi",
56 | "version": "==0.6.0"
57 | },
58 | "graphene": {
59 | "hashes": [
60 | "sha256:b8ec446d17fa68721636eaad3d6adc1a378cb6323e219814c8f98c9928fc9642",
61 | "sha256:faa26573b598b22ffd274e2fd7a4c52efa405dcca96e01a62239482246248aa3"
62 | ],
63 | "version": "==2.1.3"
64 | },
65 | "graphene-django": {
66 | "hashes": [
67 | "sha256:6abc3ec4f1dcbd91faeb3ce772b428e431807b8ec474f9dae918cff74bf7f6b1",
68 | "sha256:b336eecbf03e6fa12a53288d22015c7035727ffaa8fdd89c93fd41d9b942dd91"
69 | ],
70 | "index": "pypi",
71 | "version": "==2.1.0"
72 | },
73 | "graphql-core": {
74 | "hashes": [
75 | "sha256:889e869be5574d02af77baf1f30b5db9ca2959f1c9f5be7b2863ead5a3ec6181",
76 | "sha256:9462e22e32c7f03b667373ec0a84d95fba10e8ce2ead08f29fbddc63b671b0c1"
77 | ],
78 | "version": "==2.1"
79 | },
80 | "graphql-relay": {
81 | "hashes": [
82 | "sha256:2716b7245d97091af21abf096fabafac576905096d21ba7118fba722596f65db"
83 | ],
84 | "version": "==0.4.5"
85 | },
86 | "iso8601": {
87 | "hashes": [
88 | "sha256:210e0134677cc0d02f6028087fee1df1e1d76d372ee1db0bf30bf66c5c1c89a3",
89 | "sha256:49c4b20e1f38aa5cf109ddcd39647ac419f928512c869dc01d5c7098eddede82",
90 | "sha256:bbbae5fb4a7abfe71d4688fd64bff70b91bbd74ef6a99d964bab18f7fdf286dd"
91 | ],
92 | "version": "==0.1.12"
93 | },
94 | "promise": {
95 | "hashes": [
96 | "sha256:0bca4ed933e3d50e3d18fb54fc1432fa84b0564838cd093e824abcd718ab9304",
97 | "sha256:95506bac89df7a495e0b8c813fd782dd1ae590decb52f95248e316c6659ca49b"
98 | ],
99 | "version": "==2.1"
100 | },
101 | "pytz": {
102 | "hashes": [
103 | "sha256:a061aa0a9e06881eb8b3b2b43f05b9439d6583c206d0a6c340ff72a7b6669053",
104 | "sha256:ffb9ef1de172603304d9d2819af6f5ece76f2e85ec10692a524dd876e72bf277"
105 | ],
106 | "version": "==2018.5"
107 | },
108 | "rx": {
109 | "hashes": [
110 | "sha256:13a1d8d9e252625c173dc795471e614eadfe1cf40ffc684e08b8fff0d9748c23",
111 | "sha256:7357592bc7e881a95e0c2013b73326f704953301ab551fbc8133a6fadab84105"
112 | ],
113 | "version": "==1.6.1"
114 | },
115 | "singledispatch": {
116 | "hashes": [
117 | "sha256:5b06af87df13818d14f08a028e42f566640aef80805c3b50c5056b086e3c2b9c",
118 | "sha256:833b46966687b3de7f438c761ac475213e53b306740f1abfaa86e1d1aae56aa8"
119 | ],
120 | "version": "==3.4.0.3"
121 | },
122 | "six": {
123 | "hashes": [
124 | "sha256:70e8a77beed4562e7f14fe23a786b54f6296e34344c23bc42f07b15018ff98e9",
125 | "sha256:832dc0e10feb1aa2c68dcc57dbb658f1c7e65b9b61af69048abc87a2db00a0eb"
126 | ],
127 | "version": "==1.11.0"
128 | },
129 | "sqlparse": {
130 | "hashes": [
131 | "sha256:ce028444cfab83be538752a2ffdb56bc417b7784ff35bb9a3062413717807dec",
132 | "sha256:d9cf190f51cbb26da0412247dfe4fb5f4098edb73db84e02f9fc21fdca31fed4"
133 | ],
134 | "version": "==0.2.4"
135 | },
136 | "typing": {
137 | "hashes": [
138 | "sha256:4027c5f6127a6267a435201981ba156de91ad0d1d98e9ddc2aa173453453492d",
139 | "sha256:57dcf675a99b74d64dacf6fba08fb17cf7e3d5fdff53d4a30ea2a5e7e52543d4",
140 | "sha256:a4c8473ce11a65999c8f59cb093e70686b6c84c98df58c1dae9b3b196089858a"
141 | ],
142 | "version": "==3.6.6"
143 | }
144 | },
145 | "develop": {}
146 | }
147 |
--------------------------------------------------------------------------------