Skip to content

Commit

Permalink
clean up for deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom Gotsman committed Apr 2, 2024
1 parent 1807591 commit a58025b
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
10 changes: 6 additions & 4 deletions customer_data_app/customer_data_app/customer_data_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,9 @@ def get_users(self) -> list[Customer]:
self.users = session.exec(select(Customer)).all()
self.num_customers = len(self.users)

if self.sort_value:
self.users = sorted(self.users, key=lambda user: getattr(user, self.sort_value).lower())
## Add in code to sort the users by the sort_value
# if self.sort_value:
# self.users = sorted(self.users, key=lambda user: getattr(user, self.sort_value).lower())
return self.users


Expand Down Expand Up @@ -253,7 +254,7 @@ def navbar():
return rx.hstack(
rx.vstack(
rx.heading("Customers", size="7", font_family="Inter"),
rx.text.em("Must refresh page to see updated data or sorted data.", font_family="Inter"),
rx.text.em("Must refresh page to see updated data.", font_family="Inter"),
),
rx.spacer(),
add_customer(),
Expand All @@ -277,7 +278,8 @@ def content():
rx.hstack(
rx.heading(f"Total: {State.num_customers} Customers", size="5", font_family="Inter",),
rx.spacer(),
rx.select(["name", "email", "phone", "address"], placeholder="Sort By: Name", size="3", on_change=State.set_sort_value, font_family="Inter",),
## Code to sort the users by the sort_value
#rx.select(["name", "email", "phone", "address"], placeholder="Sort By: Name", size="3", on_change=State.set_sort_value, font_family="Inter",),
width="100%",
padding_x="2em",
padding_top="2em",
Expand Down
1 change: 1 addition & 0 deletions customer_data_app/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
reflex>=0.4.5
psycopg2-binary
11 changes: 9 additions & 2 deletions customer_data_app/rxconfig.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
import reflex as rx
import os

DB_URL = os.getenv("DB_URL")

# Checking if the API key is set properly
if not os.getenv("DB_URL"):
raise Exception("Please set DB_URL environment variable.")

config = rx.Config(
app_name="customer_data_app",
db_url="postgresql:https://postgres.dbcrpmdbfmjaoxgjcwse:[email protected]:6543/postgres"
)
db_url=DB_URL
)

0 comments on commit a58025b

Please sign in to comment.