-
Create a virtual environment:
python3 -m venv .venv -
Activate it:
source .venv/bin/activate -
Install dependencies:
pip install -r requirements.txt -
Set up PostgreSQL and create the schema from
sql/schema.sql -
Create a local
.envfile from.env.exampleand fill in your DB credentials -
Run the app:
python -m app.main
The app loads environment variables from .env automatically.
If your database was created before the title rename, run this once:
ALTER TABLE notes RENAME COLUMN topic TO title;
If your database was created before the languages table was added, run this:
CREATE TABLE languages (
id SERIAL PRIMARY KEY,
name VARCHAR(50) UNIQUE NOT NULL
);
INSERT INTO languages (name) VALUES
('Python'),
('JavaScript'),
('SQL');If your database already has a notes.language text column and you want to normalize it to language_id, run this:
INSERT INTO languages (name)
SELECT DISTINCT language
FROM notes
WHERE language IS NOT NULL
ON CONFLICT (name) DO NOTHING;
ALTER TABLE notes ADD COLUMN language_id INT REFERENCES languages(id);
UPDATE notes n
SET language_id = l.id
FROM languages l
WHERE n.language = l.name;
ALTER TABLE notes DROP COLUMN language;This project includes VS Code settings and a debugger launch config.
- Open the repo folder in VS Code
- Select the interpreter at
.venv/bin/python - Make sure your
.envfile exists - Open the Run and Debug panel
- Start
Debug Dev Notes CLIor pressF5
Recommended first breakpoints:
app/main.pyapp/menu.pyapp/models.pyapp/db.py