Git Product home page Git Product logo

share_and_talk's Introduction

Share And Talk Blog Website

English | 中文(简体)

Website Homepage

1. Introduction😁

  1. Multi-user (currently only supports qq avatars and gravatar avatars)
  2. Blog publishing, liking, editing, deleting
  3. Support for primary and secondary classification tags
  4. Support for article markdown syntax, code highlighting, Katex scientific formulas, and flowchart diagrams

Environments

  • win10x64 and above
  • Python 3.11.2
  • Mysql 8.0.32
  • Apache 2.4.46

2. Installation🍔

2.0 Docker Installation(recommended)

Please install docker first

2.0.1 Clone project

git clone https://github.com/StarrySky-skyler/Share_And_Talk.git

2.0.2 Run

docker compose up -d

2.0.3 Stop

docker compose stop

2.0.4 Delete services

docker compose down

2.1 Method 2: Manual Installation

2.1.1 Clone the project to local

pip install wheel
git clone https://github.com/StarrySky-skyler/Share_And_Talk.git

2.1.2 Install dependencies

It is recommended to create venv or other virtual environment first

pip install -r requirements.txt

2.1.3 Configure the database

First, create a new database, using utf8mb4

Open ShareAndTalk/config.py

# Database settings
dbName = 'share_and_talk'
dbUser = 'root'
dbPassword = 'skyler'
# Email settings
EMAIL_USER = 'Your email'
EMAIL_PASSWORD = 'Your password'
DEFAULT_FROM = 'Your email'

Detailes:

  • dbName : Database name
  • dbUser : Database username
  • dbPassword : Password for the corresponding user

Enter commands below

py manage.py makemigrations
py manage.py migrate

Import example database

py manage.py loaddata backup/example.json

Notice:

the example database contains

  1. a superuser. Its username is root, password is skyler

  2. a help page

  3. some default categories

2.1.4 Configure language and timezone

Default language: Simplified Chinese

Default timezone: GMT+8

See ShareAndTalk/settings.py

LANGUAGE_CODE = 'zh-hans'

TIME_ZONE = 'Asia/Shanghai'

Detailed configuration reference:

Language Identifier List🚅

Time Zone List 1 Wikipedia🧪

Time Zone List 2🎈

If you need to change to another language, you also need to delete the following code from ShareAndTalk/settings.py

# Default language
LANGUAGES = [
    ('zh-hans', '中文(简体)'),
]

2.1.5 Configure email (optional)

Used for "user feedback" at the bottom of the homepage

Open ShareAndTalk/config.py

# Database settings
dbName = 'share_and_talk'
dbUser = 'root'
dbPassword = 'skyler'
# Email settings
EMAIL_USER = 'Your email'
EMAIL_PASSWORD = 'Your password'
DEFAULT_FROM = 'Your email'

Details:

  • EMAIL_USER : Recipient email
  • EMAIL_PASSWORD : Email key
  • DEFAULT_FROM : Sending email address

See detailed reference django email configuration

2.1.6 Create a superuser

In the root directory of this project, open cmd or powershell or other terminals and enter the following command

py manage.py createsuperuser

Follow the prompts to create

2.1.7 Deployment🌭

  1. Open ShareAndTalk/settings.py and change
DEBUG = True

to

DEBUG = False
  1. Open powershell, go to the repository root directory, and run the following command to copy the static files to the static folder
py manage.py collectstatic

The static folder will be automatically created after running the command. If you need to change the folder location, please modify the following code in ShareAndTalk/settings.py

STATIC_URL = "static/"
if not DEBUG:
    STATICFILES_DIRS = (
    os.path.join(BASE_DIR, '/static/'), # Change your static folder here
    )
    STATIC_ROOT = os.path.join(BASE_DIR,'static') # Change your static folder here
  1. Configure apache2, see Notion Note

3. Supplementary Information💻

The location where website users upload files is saved in the uploads folder. If you need to change it, locate the following code at the end of ShareAndTalk/settings.py

# mdeditor
X_FRAME_OPTIONS = 'SAMEORIGIN'
MEDIA_ROOT = os.path.join(BASE_DIR, 'uploads')
MEDIA_URL = '/media/'

Just modify MEDIA_ROOT to a string containing the absolute path

Common Commands

  1. Restore table structure (enter mysql first)
source backup/db_structure.sql;
  1. Restore database data
py manage.py loaddata backup/xxx.json
  1. Django Shell
py manage.py shell
  1. Backup json data
py -Xutf8 manage.py dumpdata > db.json

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.