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

https://developer.mozilla.org/zh-CN/docs/Learn_web_development/Extensions/Server-side/Django/Introduction

django official docs

https://docs.djangoproject.com/zh-hans/5.2/faq/install/#faq-python-version-support

Conda env

https://shezw.com/note/270/macos_conda

文章地址:




标签: python, react, django, conda

添加新评论