-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Question] Postgress database support #79
Comments
I have a similar issue. I have:
and DailyNotes appears to connect. But since tables schemas have not been set up I get these errors:
It appears we need some sql script that'll initialize the tables, I believe, according to the model classes in |
I spent a few hours trying to get this to work. I instantiated the latest Postgres Docker container ( CREATE TABLE user_account (
uuid CHAR(32) NOT NULL,
username VARCHAR(64) NOT NULL,
password_hash VARCHAR(128) NOT NULL,
auto_save BOOLEAN,
PRIMARY KEY (uuid),
UNIQUE (username)
);
CREATE UNIQUE INDEX ix_user_uuid ON user_account (uuid);
CREATE TABLE IF NOT EXISTS "note" (
uuid CHAR(32) NOT NULL,
user_id CHAR(32) NOT NULL,
data VARCHAR,
title VARCHAR(128) NOT NULL,
date TIMESTAMP DEFAULT (CURRENT_TIMESTAMP),
is_date BOOLEAN,
PRIMARY KEY (uuid),
FOREIGN KEY(user_id) REFERENCES user_account (uuid)
);
CREATE UNIQUE INDEX ix_note_uuid ON note (uuid);
CREATE TABLE meta (
uuid CHAR(32) NOT NULL,
user_id CHAR(32) NOT NULL,
note_id CHAR(32) NOT NULL,
name VARCHAR,
name_compare VARCHAR,
kind VARCHAR,
PRIMARY KEY (uuid),
FOREIGN KEY(note_id) REFERENCES note (uuid),
FOREIGN KEY(user_id) REFERENCES user_account (uuid)
);
CREATE UNIQUE INDEX ix_meta_uuid ON meta (uuid); But there are a number of issues. First the class User(db.Model):
__tablename__ = 'user_account'
# ... I also needed to update class GUID(TypeDecorator):
cache_ok = True
# ... That didn't work, even after updating a few I also ran into a ton more issues when trying to put this behind an Nginx reverse proxy. The DailyNotes project doesn't use the I don't have enough time to continue debugging this. Which is unfortunate because it looked promising for my use cases, and was looking forward to adding features for my use cases. |
Yeah, I need to dig into why other databases aren't working properly, but SQLite has worked perfectly for me, so I haven't done it yet. What issues are you having running it behind a reverse proxy? |
My initial assessment is that the static files are not being served under My Docker Compose script:
The Nginx config:
My Docker Compose IMAGE_NGINX=nginx:1.23.1-alpine
IMAGE_PGADMIN=dpage/pgadmin4:6.14
IMAGE_POSTGRES=postgres:14.4-alpine3.16
################################################################################
# Postgres Configuration.
# The port to bind Postgres to inside the container.
POSTGRES_PORT=5432
# The database for Daily Notes.
POSTGRES_DATABASE=dailynotes
# The username+password credentials for the database.
# The password should be changed in production!
POSTGRES_USERNAME=postgres
POSTGRES_PASSWORD=postgres
################################################################################
# pgAdmin Configuration.
# The port to bind pgAdmin to INSIDE and OUTSIDE the container.
PGADMIN_PORT=5050
# Initial "admin" user.
# The password should be changed in production!
[email protected]
PGADMIN_DEFAULT_PASSWORD=p@55w0rd
# Set the backend URI.
# This is "BASEURL" variable that should not contain a trailing slash!
PGADMIN_BASEURL=/pgadmin
################################################################################
# Daily Notes.
# The poinr to bind Daily Notes to OUTSIDE the container.
DAILYNOTES_PORT=5000
# Set the backend URI.
# This is "BASEURL" variable that MUST contain a trailing slash!
DAILYNOTES_BASE_URL=/dailynotes/
# THe URI to the Postgres SQL database.
DAILYNOTES_DATABASE_URI=postgresql://postgres:postgres@postgres:5432
# The database encryption key.
DAILYNOTES_DB_ENCRYPTION_KEY=0123456789ABCDEF
# Prevent signups??
DAILYNOTES_PREVENT_SIGNUPS=False
################################################################################
# Nginx Configuration.
# nothing yet. |
I'll have to look at that and see what's going on |
I've tried to use an Postgress database for DialyNotes as database engine, because sqlalchemy does support it.
But using the following connection string wont work, what i am doing wrong?
DATABASE_URI = username:password@host:port/database_name
https://www.geeksforgeeks.org/connecting-postgresql-with-sqlalchemy-in-python/
The text was updated successfully, but these errors were encountered: