python 创建django环境以及结合react作为前端的基础demo
env configuration
on macos or linux , use conda to create a python env
conda create -n django python=3.12
conda activate django
# 查看python版本号是否OK
python --version
Python 3.12.12
# OK
how to select a python version
https://docs.djangoproject.com/zh-hans/5.2/faq/install/#faq-python-version-support
install django
pip install django
base python files
mkdir -p ~/django
cd ~/django
# create a new project named sample
django-admin startproject sample
cd sample
start to run base admin
python ./manage.py runserver
(django) ~/dev/django/sample $ python ./manage.py runserver
Watching for file changes with StatReloader
Performing system checks...
System check identified no issues (0 silenced).
You have 18 unapplied migration(s). Your project may not work properly until you apply the migrations for app(s): admin, auth, contenttypes, sessions.
Run 'python manage.py migrate' to apply them.
November 02, 2025 - 10:08:12
Django version 5.2.7, using settings 'sample.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
WARNING: This is a development server. Do not use it in a production setting. Use a production WSGI or ASGI server instead.
For more information on production servers see: https://docs.djangoproject.com/en/5.2/howto/deployment/
references
MDN introduction / docs
django official docs
https://docs.djangoproject.com/zh-hans/5.2/faq/install/#faq-python-version-support
Conda env
文章地址: python 创建django环境以及结合react作为前端的基础demo - Sprite keep learning
最近回复