|
2 달 전 | |
---|---|---|
.. | ||
.idea | 7 달 전 | |
.vscode | 6 달 전 | |
configs | 2 달 전 | |
constants | 3 달 전 | |
contexts | 6 달 전 | |
controllers | 2 달 전 | |
core | 2 달 전 | |
docker | 2 달 전 | |
events | 2 달 전 | |
extensions | 2 달 전 | |
factories | 3 달 전 | |
fields | 2 달 전 | |
libs | 2 달 전 | |
migrations | 3 달 전 | |
models | 2 달 전 | |
schedule | 3 달 전 | |
services | 2 달 전 | |
tasks | 2 달 전 | |
templates | 3 달 전 | |
tests | 2 달 전 | |
.dockerignore | 10 달 전 | |
.env.example | 3 달 전 | |
.ruff.toml | 2 달 전 | |
Dockerfile | 2 달 전 | |
README.md | 2 달 전 | |
app.py | 3 달 전 | |
app_factory.py | 4 달 전 | |
commands.py | 3 달 전 | |
dify_app.py | 4 달 전 | |
mypy.ini | 3 달 전 | |
poetry.lock | 2 달 전 | |
poetry.toml | 10 달 전 | |
pyproject.toml | 2 달 전 | |
pytest.ini | 4 달 전 |
[!IMPORTANT] In the v0.6.12 release, we deprecated
pip
as the package management tool for Dify API Backend service and replaced it withpoetry
.
The backend require some middleware, including PostgreSQL, Redis, and Weaviate, which can be started together using docker-compose
.
cd ../docker
cp middleware.env.example middleware.env
# change the profile to other vector database if you are not using weaviate
docker compose -f docker-compose.middleware.yaml --profile weaviate -p dify up -d
cd ../api
.env.example
to .env
cp .env.example .env
SECRET_KEY
in the .env
file.bash for Linux
sed -i "/^SECRET_KEY=/c\SECRET_KEY=$(openssl rand -base64 42)" .env
bash for Mac
secret_key=$(openssl rand -base64 42)
sed -i '' "/^SECRET_KEY=/c\\
SECRET_KEY=${secret_key}" .env
Dify API service uses Poetry to manage dependencies. You can execute poetry shell
to activate the environment.
poetry env use 3.12
poetry install
Before the first launch, migrate the database to the latest version.
poetry run python -m flask db upgrade
poetry run python -m flask run --host 0.0.0.0 --port=5001 --debug
http://localhost:3000
... poetry run python -m celery -A app.celery worker -P gevent -c 1 --loglevel INFO -Q dataset,generation,mail,ops_trace,app_deletion
poetry install -C api --with dev
tool.pytest_env
section in pyproject.toml
poetry run -P api bash dev/pytest/pytest_all_tests.sh