Under active construction!! 🚧
- Linux or Unix environment
- Terminal
- VS Code
- Postgre DB for development, with a new user
- macOS: https://postgresapp.com
- Remember to add the command line utils to
$PATH. - Run
create database chafan_dev;.
- Redis for developement
- RabbitMQ for development:
- macOS:
brew install rabbitmq(see more in "RabbitMQ dev setup in macOS")
- macOS:
- Install Poetry package manager https://python-poetry.org
poetry installto create virtual env and install all Python dependenciespoetry shellto enter the virtual env. You need to run this everytime in this repo before running other commands that depends on Python code.make link-venvto create a symbolic to virtual env such that VSCode is happy (if necessary, Run "Reload window" and make sure that the Python environment is.venv).- Use VSCode with Python extension (Pylance is recommended).
Example .env for basic development (update DATABASE_URL, REDIS_URL, RABBITMQ_URL if necessary):
SERVER_NAME=dev.cha.fan
SERVER_HOST=http://dev.cha.fan:4582
BACKEND_CORS_ORIGINS=["http://dev.cha.fan:8080"]
PROJECT_NAME=Chafan Dev
SECRET_KEY=chafandev
[email protected]
FIRST_SUPERUSER_PASSWORD=superuser
USERS_OPEN_REGISTRATION=False
DATABASE_URL=postgresql://chafan@localhost:5432/chafan_dev
ENV=dev
REDIS_URL=redis://127.0.0.1:6379
RABBITMQ_URL=amqp://guest:guest@localhost:5672/%2f
Run following commands to create database and initialize chafan_dev table.
# Run migrations
alembic upgrade head
# Create initial data in DB
python scripts/initial_data.pyAfter initialization, run dev server:
make dev-run
Open http://dev.cha.fan:4582/docs for API docs.
<<<<<<< HEAD
nix develop
source ../launch_env
echo $DATABASE_URL
pg_ctl start -l logfile -D $CHAFAN_PG_DB_CLUSTER -o "--unix_socket_directories='$CHAFAN_PG_DB_BASE' -p $CHAFAN_PG_PORT"
- Modify
app/models - Also modify
app/models/__init__.py
alembic revision --autogenerate -m "Add column last_name to User model"See doc and StackOverflow
SHALL manually check the generated version file, eg 4794c0c3c743_add_view_count_tables.py
alembic upgrade head
Check PostgreSQL DB and TABLE alembic_version.
alembic downgrade 6162e247214e
Reset persistent state before testing:
bash scripts/reset_app_state.sh
Test a single file:
pytest -vv chafan_core/tests/app/email/test_email.py
Test all:
pytest
stag branch is automatically pushed to the following endpoint for testing:
https://chafan-test.dokku.cha.fan/
- Core backend code changes
- Add event definition:
chafan_core/app/schemas/event.py - If the event goes to activity feed
- Feed distribution:
chafan_core/app/feed.py:get_activity_receivers
- Feed distribution:
- If the event goes to notifications
chafan_core/app/materialize.py:materialize_eventand_KEYS(if there is a new type of field)chafan_core/app/common.py:EVENT_TEMPLATES
- Add event definition:
- PWA code changes
- Add event definition:
src/interfaces/index.ts - If the event goes to activity feed
- Update event card:
src/views/main/Home.vue
- Update event card:
- Update event field rendering:
src/components/Event.vue(if there is a new type of field) - Update event translation rendering:
src/main.ts
- Add event definition:
Run poetry update to update all dependencies.
For all files within this repo, see LICENSE for default copyright unless otherwise declared in file: