Coder Social home page Coder Social logo

ginkurenai / vue-django-blog Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 2.07 MB

Frontend -> Vue, Backend -> Django, Web Server -> Nginx, DB -> MySQL

License: Other

Dockerfile 0.33% Python 46.58% JavaScript 5.78% HTML 0.56% Vue 36.97% Shell 0.34% SCSS 9.43%

vue-django-blog's Introduction

Vue-django Based Blog

This is an SPI blog developed using Vue and Django. This blog is developed using Docker, so it runs easily on the environment at hand.

Features

Configration Diagram

ConfigrationDiagram

Description

  • Backend

The backend is implemented with Django Rest Framework, an API that communicates with Nginx using wsgi (port number 8001) and exchanges data in JSON format.

  • Frontend

The frontend is implemented using Vue. Vite is used as the build tool to speed up hot reloading; hot reloading does not work when accessing from port 80, so developers should connect to port 3000 for development.

( Vue does not support SSR, which may result in disadvantageous SEO in search engines. Therefore, we plan to migrate to Nuxt.js. We will also migrate to Typescript as needed. )

  • Database

The database is implemented using MySQL, which handles data exchange with the Django REST API. To develop, please refer to the .env.sample to set up the MySQL server username and password, and create the .env file in the same hierarchical directory.

  • Web Server

The Web Server uses Nginx to realize a reverse proxy, allowing the frontend (Vue) and backend (Django) to work together in response to requests from port 80.

Requirement

This application is developed using Docker; Windows or Mac users should install Docker Desktop.

Click here for installation instructions.

Installation

  1. Clone this repository:
git clone https://github.com/GinKuReNai/vue-django-blog.git
  1. Change directory and make docker image:
cd vue-django-blog
docker compose build
  1. Deploy Vue:
docker compose run frontend npm run build
  1. Start docker containers:
docker compose down
docker compose up -d
  1. Move to the backend container and perform ORM migration:
docker compose exec backend bash
python3 manage.py makemigrations
python3 manage.py migrate
  1. Collect static files in the backend container:
python3 manage.py collectstatic.

If you encounter errors during migration, such as database tables not being found, go to the database container and execute the following commands:

docker compose exec db bash
mysql -u <username> -p
drop database blog_data;
create database blog_data character set utf8;

Usage

  • Home

http://localhost/

  • Development Server

http://localhost:3000/

Access to hot reloading to check changes as they occur.

  • Admin Site (Django)

http://localhost/admin/

Access this page to use the blog's administration screen to post and edit articles, add tags and categories, etc.

  1. Move to the backend container and Create superuser:
docker compose exec backend bash
python3 manage.py createsuperuser
  1. Follow the instructions to enter your information.

  2. Access to here and login to the admin site.

  3. You can post articles, add tags, and perform other blog operations from the administration screen.

AdminSite

  • REST Api

http://localhost/api/

Access the API to check the input/output of JSON format objects or to check the REST functionality of the API.

PostsApi

Note

Feel free to modify the frontend implementation.

Author

Akito Koga

License

The source code is licensed MIT. The website content is licensed CC BY 4.0,see LICENSE.

vue-django-blog's People

Contributors

ginkurenai avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.