mirror of
https://github.com/fastapi-admin/fastapi-admin.git
synced 2026-03-13 10:32:25 +08:00
Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
141
.dockerignore
Normal file
141
.dockerignore
Normal file
@@ -0,0 +1,141 @@
|
||||
# Created by .ignore support plugin (hsz.mobi)
|
||||
### 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
|
||||
.env
|
||||
.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/
|
||||
|
||||
@@ -4,6 +4,6 @@ WORKDIR /fastapi-admin
|
||||
COPY pyproject.toml poetry.lock /fastapi-admin/
|
||||
RUN pip3 install poetry
|
||||
ENV POETRY_VIRTUALENVS_CREATE false
|
||||
RUN poetry install
|
||||
RUN poetry install --no-root
|
||||
COPY . /fastapi-admin
|
||||
RUN poetry install
|
||||
|
||||
39
README.md
39
README.md
@@ -48,32 +48,23 @@ Data in database will restore every day.
|
||||
|
||||
## Quick Start
|
||||
|
||||
### Run Example Local
|
||||
### Run Backend
|
||||
|
||||
Look at
|
||||
[examples](https://github.com/long2ice/fastapi-admin/tree/master/examples).
|
||||
Look full example at
|
||||
[examples](https://github.com/long2ice/fastapi-admin/tree/dev/examples).
|
||||
|
||||
1. `git clone https://github.com/long2ice/fastapi-admin.git`.
|
||||
2. create database `fastapi-admin` and import from
|
||||
`examples/example.sql`.
|
||||
3. run `poetry install`, you must install [poetry](https://github.com/python-poetry/poetry) first.
|
||||
4. `env DATABASE_URL=mysql://root:123456@127.0.0.1:3306/fastapi-admin PYTHONPATH=./ python3 examples/main.py`, then
|
||||
you can see:
|
||||
2. `docker-compose up -d --build`.
|
||||
3. `docker-compose exec -T mysql mysql -uroot -p123456 < examples/example.sql fastapi-admin`.
|
||||
4. That's just all, api server is listen at [http://127.0.0.1:8000](http://127.0.0.1:8000) now.
|
||||
|
||||
```log
|
||||
INFO: Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)
|
||||
INFO: Started reloader process [89005]
|
||||
INFO: Started server process [89009]
|
||||
INFO: Waiting for application startup.
|
||||
INFO: Tortoise-ORM startup
|
||||
connections: {'default': 'mysql://root:123456@127.0.0.1:3306/fastapi-admin'}
|
||||
apps: {'models': {'models': ['examples.models'], 'default_connection': 'default'}}
|
||||
INFO: Tortoise-ORM started, {'default': <tortoise.backends.mysql.client.MySQLClient object at 0x110ed6760>}, {'models': {'Category': <class 'examples.models.Category'>, 'Product': <class 'examples.models.Product'>, 'User': <class 'examples.models.User'>}}
|
||||
INFO: Tortoise-ORM generating schema
|
||||
INFO: Application startup complete.
|
||||
```
|
||||
### Run Front
|
||||
|
||||
### Backend Integration
|
||||
See
|
||||
[restful-admin](https://github.com/long2ice/restful-admin)
|
||||
for reference.
|
||||
|
||||
## Backend Integration
|
||||
|
||||
```shell
|
||||
> pip3 install fastapi-admin
|
||||
@@ -104,12 +95,6 @@ async def startup():
|
||||
)
|
||||
```
|
||||
|
||||
### Front
|
||||
|
||||
See
|
||||
[restful-admin](https://github.com/long2ice/restful-admin)
|
||||
for reference.
|
||||
|
||||
## Features
|
||||
|
||||
### Builtin Auth And Permissions Control
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
version: '3'
|
||||
services:
|
||||
mysql:
|
||||
image: mariadb
|
||||
image: mysql
|
||||
environment:
|
||||
MYSQL_ROOT_PASSWORD: 123456
|
||||
MYSQL_DATABASE: fastapi-admin
|
||||
healthcheck:
|
||||
test: --health-cmd "mysqladmin ping" --health-interval 10s --health-timeout 5s --health-retries 10
|
||||
api:
|
||||
build: .
|
||||
restart: always
|
||||
environment:
|
||||
DATABASE_URL: mysql://root:123456@mysql:3306/fastapi-admin
|
||||
ports:
|
||||
|
||||
Reference in New Issue
Block a user