English | 中文(简体)
- Multi-user (currently only supports qq avatars and gravatar avatars)
- Blog publishing, liking, editing, deleting
- Support for primary and secondary classification tags
- Support for article markdown syntax, code highlighting, Katex scientific formulas, and flowchart diagrams
- win10x64 and above
- Python 3.11.2
- Mysql 8.0.32
- Apache 2.4.46
Please install docker first
git clone https://github.com/StarrySky-skyler/Share_And_Talk.git
docker compose up -d
docker compose stop
docker compose down
pip install wheel
git clone https://github.com/StarrySky-skyler/Share_And_Talk.git
It is recommended to create venv or other virtual environment first
pip install -r requirements.txt
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 namedbUser
: Database usernamedbPassword
: 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
-
a superuser. Its username is root, password is skyler
-
a help page
-
some default categories
Default language: Simplified Chinese
Default timezone: GMT+8
See ShareAndTalk/settings.py
LANGUAGE_CODE = 'zh-hans'
TIME_ZONE = 'Asia/Shanghai'
Detailed configuration reference:
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', '中文(简体)'),
]
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 emailEMAIL_PASSWORD
: Email keyDEFAULT_FROM
: Sending email address
See detailed reference django email configuration
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
- Open
ShareAndTalk/settings.py
and change
DEBUG = True
to
DEBUG = False
- 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 inShareAndTalk/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
- Configure apache2, see Notion Note
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
- Restore table structure (enter mysql first)
source backup/db_structure.sql;
- Restore database data
py manage.py loaddata backup/xxx.json
- Django Shell
py manage.py shell
- Backup json data
py -Xutf8 manage.py dumpdata > db.json