Project Name | Stars | Downloads | Repos Using This | Packages Using This | Most Recent Commit | Total Releases | Latest Release | Open Issues | License | Language |
---|---|---|---|---|---|---|---|---|---|---|
Free Programming Books Zh_cn | 100,748 | 3 days ago | 29 | gpl-3.0 | ||||||
:books: 免费的计算机编程类中文书籍,欢迎投稿 | ||||||||||
Awesome Cheatsheets | 32,908 | 2 days ago | 85 | mit | JavaScript | |||||
👩💻👨💻 Awesome cheatsheets for popular programming languages, frameworks and development tools. They include everything you should know in one single file. | ||||||||||
Onlinejudge | 5,138 | 3 months ago | 113 | mit | Python | |||||
open source online judge based on Vue, Django and Docker. | 青岛大学开源 Online Judge | QQ群 496710125 | [email protected] | ||||||||||
Gerapy | 2,906 | 8 | 2 months ago | 47 | December 30, 2021 | 54 | mit | Python | ||
Distributed Crawler Management Framework Based on Scrapy, Scrapyd, Django and Vue.js | ||||||||||
Simpleui | 2,873 | 13 | 2 | 9 days ago | 107 | June 13, 2022 | 16 | mit | Python | |
A modern theme based on vue+element-ui for django admin.一款基于vue+element-ui的django admin现代化主题。全球20000+网站都在使用!喜欢可以点个star✨ | ||||||||||
Pinry | 2,721 | 4 months ago | 49 | bsd-2-clause | Python | |||||
Pinry, a tiling image board system for people who want to save, tag, and share images, videos and webpages in an easy to skim through format. It's open-source and self-hosted. | ||||||||||
Modoboa | 2,466 | 8 hours ago | 82 | isc | Python | |||||
Mail hosting made simple | ||||||||||
Loonflow | 1,627 | a month ago | 11 | mit | Python | |||||
基于django的工作流引擎,工单(a workflow engine base on django python) | ||||||||||
Tacticalrmm | 1,584 | 3 days ago | 117 | May 15, 2022 | 206 | other | Python | |||
A remote monitoring & management tool, built with Django, Vue and Go. | ||||||||||
Django Vue Template | 1,453 | 4 months ago | 41 | mit | Python | |||||
Django Rest + Vue JS Template |
This template is a minimal example for an application using Vue and Django.
Vue and Django are clearly separated in this project. Vue, Yarn and Webpack handles all frontend logic and bundling assessments. Django and Django REST framework to manage Data Models, Web API and serve static files.
While it's possible to add endpoints to serve django-rendered html responses, the intention is to use Django primarily for the backend, and have view rendering and routing and handled by Vue + Vue Router as a Single Page Application (SPA).
Out of the box, Django will serve the application entry point (index.html
+ bundled assets) at /
,
data at /api/
, and static files at /static/
. Django admin panel is also available at /admin/
and can be extended as needed.
The application templates from Vue CLI create
and Django createproject
are kept as close as possible to their
original state, except where a different configuration is needed for better integration of the two frameworks.
If this setup is not what you are looking for, you might want look at other similar projects:
Prefer Flask? Checkout my gtalarico/flask-vuejs-template
Location | Content |
---|---|
/backend |
Django Project & Backend Config |
/backend/api |
Django App (/api ) |
/src |
Vue App . |
/src/main.js |
JS Application Entry Point |
/public/index.html |
Html Application Entry Point (/ ) |
/public/static |
Static Assets |
/dist/ |
Bundled Assets Output (generated at yarn build ) |
Before getting started you should have the following installed and running:
$ git clone https://github.com/gtalarico/django-vue-template
$ cd django-vue-template
Setup
$ yarn install
$ pipenv install --dev && pipenv shell
$ python manage.py migrate
$ python manage.py runserver
From another tab in the same directory:
$ yarn serve
The Vue application will be served from localhost:8080
and the Django API
and static files will be served from localhost:8000
.
The dual dev server setup allows you to take advantage of
webpack's development server with hot module replacement.
Proxy config in vue.config.js
is used to route the requests
back to django's API on port 8000.
If you would rather run a single dev server, you can run Django's
development server only on :8000
, and you have to build the Vue app first
and the page will not reload on changes.
$ yarn build
$ python manage.py runserver
Follow this guide to ensure you have pipenv setup
https://www.jetbrains.com/help/pycharm/pipenv.html
Click "Edit Configurations"
Select Django Server under templates
Click + to create a config from the templates
In Environment variables add
PYTHONUNBUFFERED=1;DJANGO_SETTINGS_MODULE=backend.settings.dev
Click Apply then Ok
ALLOWED_HOSTS
on backend.settings.prod
$ heroku apps:create django-vue-template-demo
$ heroku git:remote --app django-vue-template-demo
$ heroku buildpacks:add --index 1 heroku/nodejs
$ heroku buildpacks:add --index 2 heroku/python
$ heroku addons:create heroku-postgresql:hobby-dev
$ heroku config:set DJANGO_SETTINGS_MODULE=backend.settings.prod
$ heroku config:set DJANGO_SECRET_KEY='...(your django SECRET_KEY value)...'
$ git push heroku
Heroku's nodejs buildpack will handle install for all the dependencies from the package.json
file.
It will then trigger the postinstall
command which calls yarn build
.
This will create the bundled dist
folder which will be served by whitenoise.
The python buildpack will detect the Pipfile
and install all the python dependencies.
The Procfile
will run Django migrations and then launch Django'S app using gunicorn, as recommended by heroku.
See settings.dev
and vue.config.js
for notes on static assets strategy.
This template implements the approach suggested by Whitenoise Django. For more details see WhiteNoise Documentation
It uses Django Whitenoise to serve all static files and Vue bundled files at /static/
.
While it might seem inefficient, the issue is immediately solved by adding a CDN
with Cloudfront or similar.
Use vue.config.js
> baseUrl
option to set point all your assets to the CDN,
and then set your CDN's origin back to your domains /static
url.
Whitenoise will serve static files to your CDN once, but then those assets are cached and served directly by the CDN.
This allows for an extremely simple setup without the need for a separate static server.