Getting a blank page when loading /admin
in litestar.
#380
-
I'm trying to run piccolo admin in my litestar app, I created db, ran migrations and started the app but I don't see anything on the
These are my config files: # utils.db
import os
from piccolo.conf.apps import AppConfig, table_finder
TABLES = [
"controllers.admissions.tables",
]
APP_CONFIG = AppConfig(
app_name="utils.db",
migrations_folder_path=os.path.join(os.getcwd(), "migrations"),
table_classes=table_finder(modules=TABLES, exclude_imported=True),
migration_dependencies=[],
commands=[],
) # utils.config, custom piccolo_conf
import os
from piccolo.conf.apps import AppRegistry
from piccolo.engine.postgres import PostgresEngine
DATABASE_URI = os.environ.get("DATABASE_URI")
if DATABASE_URI is None:
import dotenv
dotenv.load_dotenv()
DATABASE_URI = os.environ["DATABASE_URI"]
DB = PostgresEngine(config={"dsn": DATABASE_URI})
APP_REGISTRY = AppRegistry(apps=["utils.db", "piccolo_admin.piccolo_app"]) I ran migrations using following commands: export PICCOLO_CONF=utils.config; piccolo migrations new utils.db --auto export PICCOLO_CONF=utils.config; piccolo migrations forwards utils.db
export PICCOLO_CONF=utils.config; piccolo migrations forwards session_auth
export PICCOLO_CONF=utils.config; piccolo migrations forwards user |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Is this the latest version of litestar? It looks like the problem is that the static files for Piccolo Admin are returning a 404. It could be something to do with how litestar mounts ASGI apps. @sinisaos I remember us looking into this at some point with the litestar team, do you have any ideas? @AmazingAkai How are you mounting Piccolo Admin in your litestar app? |
Beta Was this translation helpful? Give feedback.
At the end of the url there should be a trailing slash like this
http://localhost:8000/admin/
, becausehttp://localhost:8000/admin
without a trailing slash doesn't work. @AmazingAkai here and here is an example of using Litestar with Piccolo. Mounting Piccolo Admin to Litestar is like this