Stand alone¶
In order to get started with developing hypha locally, you'll need the following minimal setup, the setup may vary slightly for your base operating systems.
1. System dependencies¶
Make sure you have these things installed on your system:
- Git – Installation Guide
- uv – Installation Guide
- Python 3.12 (installed automatically with uv)
- Node 20.18
- PostgreSQL 14 (with
libpq-dev
on Linux)
Info
On Linux install them with your normal package manager. On macOS Homebrew is an excellent option. For Windows Chocolatey seems popular but we have no experience with Windows.
This project ships with .python-version
and .nvmrc
to support uv and nvm. You can use it to setup the correct versions of Python and Node required for this project.
Installing PostgreSQL¶
This process was tested on Ubuntu 22.04 LTS. It should work on any Debian-based system.
Install PostgreSQL:
This process was tested on Fedora Workstation 38. It should work on RHEL as well.
Install PostgreSQL:
2. Get the code and dependencies¶
Clone the repo with git¶
Use git
to fetch the code, this will create a hypha/
directory.
Now, create some local directories.
NOTE: In production media is stored on AWS S3 but for local development you need a "media" directory. The var/log
is used to store local logs, if configured.
Info
Everything from now on will happen inside the hypha/
directory.
Set up the python virtual environment and install dependencies with uv¶
This vill create a .venv
directory (if it does not exist) and install all python dependencies there.
All uv …
commands will automatically use this virtual envionment.
If you want other commands to use it you need to run this command to activate it.
Installing Node Version Manager¶
NodeJS versions have potential to change. To allow for ease of upgrading, it is recommended to use Node Version Manager (nvm).
The following commands will install nvm and proceed to setup Node based off of the content of .nvmrc
.
See Installing and Updating Node Version Manager
Install all node packages and compile JS & SCSS¶
Install node dependencies.
Build all JS/CSS assets for development:
Info
Hypha uses NodeJS to compile SCSS and JS from the hypha/static_src/
directory. See the package.json
file for a complete list of commands.
3. Add and update Hypha configuration¶
Hypha supports configuration via either a local.py
or a .env
file:
Create an empty .env
file at the root of the project:
.
├── .env
├── manage.py
├── hypha
│ ├── urls.py
│  ├── settings/
│  ├── ...
├── ...
Open .env
file and add your config:
Copy the provided local.py.example
file and rename it to local.py
.
.
├── manage.py
├── hypha
│ ├── urls.py
│  ├── settings
│  │  ├── __init__.py
│  │  ├── base.py
│  │  ├── dev.py
│  │  ├── django.py
│  │  ├── local.py
│  │  ├── local.py.example
│  │  ├── production.py
│  │  └── test.py
│  ├── ...
├── ...
Open and take a look at the local.py
, it already has some sensible defaults and you can use this to override all the settings.
4. Setup the database and add initial data¶
Create an empty database:
Ensure database name hypha
is added to your hypha/settings/local.py
or .env
.
Let's create all the tables and schemas required by the project.
There are two ways to about it, you can either load demo data from /public/sandbox_db.dump
or start with empty tables.
Tips
- If
createdb
anddropdb
are not available you will need to add the Postgres bin directory to yourpath
or call the commands with complete path. - If you need to delete/drop the database, you can use
dropdb hypha
-
On Linux you might need to run as the "postgres" user first when setting up Postgres. Use it to create the database and set up a database user.For local development I suggest creating a user with the same name as your account, then you will not need to specify it on every command.
5. Setup site¶
You will need two domain to run this app, used to serve the public and apply site on different domains
First, add these sites to the database:
Then, add this to your /etc/hosts
file.
Here we are setting the public site be served at http://hypha.test:9001.
Is it safe to use .test?
The ".test" TLD is safe to use, it's reserved for testing purposes. Feel free to use another name but then remember to use it in all the commands below.
6. Create login credentials¶
7. Run development server¶
You can use make serve
command to run Django Development Server, watch and compile frontend changes and preview docs all at once.
Now you should be able to access the site.
Hypha development server: http://hypha.test:9001/
Documentation preview¶
A live preview of documentation is available at this address.
MkDocs development server: http://localhost:9100/
8. Running tests¶
Hypha uses ruff
and py.test test runner and uses hypha/settings/testing.py
for test settings.
For frontend code, stylelint and biome is used.
Run the test with:
For lint the code and not run the full test suite you can use:
9. Helpful URLs¶
- The Apply dashboard: http://hypha.test:9001/dashboard/
- The Apply Wagtail admin: http://hypha.test:9001/admin/
- The Django Administration panel: http://hypha.test:9001/django-admin/
Use the email address and password you set in the createsuperuser
step above to login.