From a3f5386395ced9f58948ceada8dfc5b76a1b0b81 Mon Sep 17 00:00:00 2001 From: zy7y <13271962515@163.com> Date: Wed, 29 Dec 2021 22:29:01 +0800 Subject: [PATCH] init: project --- .env.development | 16 +++++ .env.production | 0 .gitignore | 141 ++++++++++++++++++++++++++++++++++++++++++++ api/__init__.py | 0 core/__init__.py | 0 core/config.py | 29 +++++++++ crud/__init__.py | 0 main.py | 13 ++++ models/__init__.py | 0 models/user.py | 0 requirements.txt | Bin 0 -> 782 bytes schemas/__init__.py | 0 tests/__init__.py | 0 utils.py | 0 14 files changed, 199 insertions(+) create mode 100644 .env.development create mode 100644 .env.production create mode 100644 .gitignore create mode 100644 api/__init__.py create mode 100644 core/__init__.py create mode 100644 core/config.py create mode 100644 crud/__init__.py create mode 100644 main.py create mode 100644 models/__init__.py create mode 100644 models/user.py create mode 100644 requirements.txt create mode 100644 schemas/__init__.py create mode 100644 tests/__init__.py create mode 100644 utils.py diff --git a/.env.development b/.env.development new file mode 100644 index 0000000..3f332b9 --- /dev/null +++ b/.env.development @@ -0,0 +1,16 @@ +ENVIRONMENT=development + +# jwt +SECRET_KEY=JwrddNQ1jbhdgEqEXhIVqUU1PineCLVW4evEKly2Zdc + +# 数据库 +MYSQL_SERVER=localhost:3306 +MYSQL_USER=root +MYSQL_PASSWORD=123456 +MYSQL_DB=mall + +# redis +REDIS_SERVER=localhost:6379 + +#rabbitMQ + diff --git a/.env.production b/.env.production new file mode 100644 index 0000000..e69de29 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4c224c4 --- /dev/null +++ b/.gitignore @@ -0,0 +1,141 @@ +### Python template +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +share/python-wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.nox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +*.py,cover +.hypothesis/ +.pytest_cache/ +cover/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py +db.sqlite3 +db.sqlite3-journal + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +.pybuilder/ +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# IPython +profile_default/ +ipython_config.py + +# pyenv +# For a library or package, you might want to ignore these files since the code is +# intended to run in multiple environments; otherwise, check them in: +# .python-version + +# pipenv +# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. +# However, in case of collaboration, if having platform-specific dependencies or dependencies +# having no cross-platform support, pipenv may install dependencies that don't work, or not +# install all needed dependencies. +#Pipfile.lock + +# PEP 582; used by e.g. github.com/David-OConnor/pyflow +__pypackages__/ + +# Celery stuff +celerybeat-schedule +celerybeat.pid + +# SageMath parsed files +*.sage.py + +# Environments +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ +.dmypy.json +dmypy.json + +# Pyre type checker +.pyre/ + +# pytype static type analyzer +.pytype/ + +# Cython debug symbols +cython_debug/ +.idea + + diff --git a/api/__init__.py b/api/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/core/__init__.py b/core/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/core/config.py b/core/config.py new file mode 100644 index 0000000..27f5e75 --- /dev/null +++ b/core/config.py @@ -0,0 +1,29 @@ +from pydantic import BaseSettings + + +class Settings(BaseSettings): + SECRET_KEY: str + + # 数据库 + MYSQL_ADDRESS: str + MYSQL_USER: str + MYSQL_PASSWORD: str + MYSQL_DB: str + + # redis, ip + 端口 + REDIS_SERVER: str + + # rabbitMQ + RABBITMQ_ADDRESS: str + + # 短信服务 + + # 邮件服务 + + # 支付宝信息 + + # 存储服务信息 + + +# pip freeze > requirements.txt +# settings = Settings(_env_file='prod.env', _env_file_encoding='utf-8') \ No newline at end of file diff --git a/crud/__init__.py b/crud/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/main.py b/main.py new file mode 100644 index 0000000..5ff382a --- /dev/null +++ b/main.py @@ -0,0 +1,13 @@ +from fastapi import FastAPI +from fastapi.middleware.cors import CORSMiddleware + + +app = FastAPI() + +app.add_middleware( + CORSMiddleware, + allow_origins=["*"], + allow_credentials=True, + allow_methods=["*"], + allow_headers=["*"], +) diff --git a/models/__init__.py b/models/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/models/user.py b/models/user.py new file mode 100644 index 0000000..e69de29 diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000000000000000000000000000000000000..01ef3a58208a29ae517e0454333cc34815f33ad0 GIT binary patch literal 782 zcmZ8f(N2Rv5S(WdKZORcY4O27&_v@07y?u;El`0N_2bo<-QHErk`>RHW z2>}gWaKn>hg$-|kOI)C4WJHe-%y`8iA%rS<&KQpeEaZzk1-8WHC)7X|u_=1R@9Pw6 z$SehWi&gf0MU2=RW*m4YYUz0+x3brUXwedJWNe~JuU;@(STA0^HU5RjfE|x|j!f4{ z$BrB`JE+MPQhaMX?nfZQa8jWjTw`F?h>E`DtQvV;!^Sio*?Y^pf$Zv37{%4AyLeB; z9q%I^aGN-!&1;Au_87?XY#3?qiODO+1o~JbVJ-L>o!S_Kd l|2xWvpO|rWT>Dm;eyHy>iL<;q*EZ@Pn?LRAfaRC4T literal 0 HcmV?d00001 diff --git a/schemas/__init__.py b/schemas/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/utils.py b/utils.py new file mode 100644 index 0000000..e69de29