Skip to content

vzvanov/django_vue_auth

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Django + Vue JS + Materialize CSS

Vue Logo Django Logo

This template is a minimal example for an application using Vue and Django.

It's setup to have a clear separation: use Vue to handle all frontend logic and assets bundling, and use Django with Django REST framework to manage a 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).

Alternatives

If this setup is not what you are looking for, you might want look at other similar projects:

Includes

  • Django
  • Django REST framework
  • Vue CLI 3
  • Vue Router
  • Vuex

Template Structure

Location Content
/auth_project Django Project & Backend Config
/auth_project/api Django App (/api)
frontend/src Vue App .
frontend//src/main.js JS Application Entry Point
/public/index.html Html Application Entry Point (/)

Prerequisites

Before getting started you should have the following installed and running:

Setup Template

$ git clone https://github.com/vzvanov/django_vue_auth
$ cd django_vue_auth

Setup

$ python -m venv env_auth
$ env_auth\Scripts\activate.bat
$ pip install -r requirements.txt
$ python manage.py migrate
$ python manage.py createsuperuser

Running Development Servers

$ python manage.py runserver

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, but you have to build build the Vue app first and the page will not reload on changes.

$ npm run serve
$ python manage.py runserver

About

Django REST API + VUE JS + Materialize CSS. Authentication and handling requests.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published