|  | 3 月之前 | |
|---|---|---|
| .. | ||
| .idea | 1 年之前 | |
| .vscode | 1 年之前 | |
| configs | 3 月之前 | |
| constants | 3 月之前 | |
| contexts | 5 月之前 | |
| controllers | 3 月之前 | |
| core | 3 月之前 | |
| docker | 3 月之前 | |
| events | 3 月之前 | |
| extensions | 3 月之前 | |
| factories | 3 月之前 | |
| fields | 3 月之前 | |
| libs | 3 月之前 | |
| migrations | 3 月之前 | |
| models | 3 月之前 | |
| repositories | 3 月之前 | |
| schedule | 3 月之前 | |
| services | 3 月之前 | |
| tasks | 3 月之前 | |
| templates | 3 月之前 | |
| tests | 3 月之前 | |
| .dockerignore | 6 月之前 | |
| .env.example | 3 月之前 | |
| .ruff.toml | 4 月之前 | |
| Dockerfile | 3 月之前 | |
| README.md | 3 月之前 | |
| app.py | 5 月之前 | |
| app_factory.py | 5 月之前 | |
| commands.py | 3 月之前 | |
| dify_app.py | 11 月之前 | |
| mypy.ini | 4 月之前 | |
| pyproject.toml | 3 月之前 | |
| pytest.ini | 5 月之前 | |
| uv.lock | 3 月之前 | |
[!IMPORTANT]
In the v1.3.0 release,
poetryhas been replaced withuvas the package manager for Dify API backend service.
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 UV to manage dependencies. First, you need to add the uv package manager, if you don’t have it already.
   pip install uv
   # Or on macOS
   brew install uv
   uv sync --dev
Before the first launch, migrate the database to the latest version.
   uv run flask db upgrade
   uv run flask run --host 0.0.0.0 --port=5001 --debug
http://localhost:3000.   uv run celery -A app.celery worker -P gevent -c 1 --loglevel INFO -Q dataset,generation,mail,ops_trace,app_deletion,plugin
Addition, if you want to debug the celery scheduled tasks, you can use the following command in another terminal:
   uv run celery -A app.celery beat 
   uv sync --dev
tool.pytest_env section in pyproject.toml   uv run -P api bash dev/pytest/pytest_all_tests.sh