|
|
2ヶ月前 | |
|---|---|---|
| .. | ||
| .idea | 1年前 | |
| .vscode | 1年前 | |
| configs | 2ヶ月前 | |
| constants | 3ヶ月前 | |
| contexts | 5ヶ月前 | |
| controllers | 2ヶ月前 | |
| core | 2ヶ月前 | |
| docker | 2ヶ月前 | |
| events | 2ヶ月前 | |
| extensions | 2ヶ月前 | |
| factories | 2ヶ月前 | |
| fields | 2ヶ月前 | |
| libs | 2ヶ月前 | |
| migrations | 2ヶ月前 | |
| models | 2ヶ月前 | |
| repositories | 2ヶ月前 | |
| schedule | 2ヶ月前 | |
| services | 2ヶ月前 | |
| tasks | 2ヶ月前 | |
| templates | 3ヶ月前 | |
| tests | 2ヶ月前 | |
| .dockerignore | 6ヶ月前 | |
| .env.example | 2ヶ月前 | |
| .ruff.toml | 2ヶ月前 | |
| Dockerfile | 2ヶ月前 | |
| README.md | 2ヶ月前 | |
| app.py | 5ヶ月前 | |
| app_factory.py | 2ヶ月前 | |
| child_class.py | 2ヶ月前 | |
| commands.py | 2ヶ月前 | |
| dify_app.py | 11ヶ月前 | |
| lazy_load_class.py | 2ヶ月前 | |
| mypy.ini | 2ヶ月前 | |
| pyproject.toml | 2ヶ月前 | |
| pytest.ini | 5ヶ月前 | |
| uv.lock | 2ヶ月前 | |
[!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
Start Dify web service.
Setup your application by visiting http://localhost:3000.
If you need to handle and debug the async tasks (e.g. dataset importing and documents indexing), please start the worker service.
uv run celery -A app.celery worker -P gevent -c 1 --loglevel INFO -Q dataset,generation,mail,ops_trace,app_deletion,plugin,workflow_storage,conversation
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, more can check Claude.md uv run pytest # Run all tests
uv run pytest tests/unit_tests/ # Unit tests only
uv run pytest tests/integration_tests/ # Integration tests
# Code quality
../dev/reformat # Run all formatters and linters
uv run ruff check --fix ./ # Fix linting issues
uv run ruff format ./ # Format code
uv run mypy . # Type checking