Comments (3)
I encountered a very similar issue: we use FastAPI.root_path
parameter because app is running behind a proxy.
I think the most correct way is to rely on FastAPI resolver - call fastapi.Request.url_for
.
Meanwhile, I did a quick workaround in my project:
admin = Admin(
app,
engine,
authentication_backend=auth_backend,
base_url='/admin-ui',
)
admin.add_view(view)
if view.is_model and app.root_path:
# This URL goes directly into template into Select2 widget
# With current code (sqladmin 0.16.1) it goes as is
# The URL will be: /admin-ui/my-model/ajax/lookup
# But the correct one for production is prefixed
# /proxy-prefix/admin-ui/my-model/ajax/lookup
view.ajax_lookup_url = app.root_path + view.ajax_lookup_url
from sqladmin.
@IBestuzhev yes, it works.
from sqladmin.
@IBestuzhev But the Request.url_for is not available in this context.
from sqladmin.
Related Issues (20)
- Raised value error HOT 5
- Define default values via form_args
- TypeError: UUID objects are immutable (fastapi_users) HOT 4
- ValueError on passing unexcepted parameter
- Use HTMX HOT 3
- jinja2.exceptions.TemplateNotFound: list.html HOT 3
- What about Router per View? HOT 2
- with ... as ... statement can make sesssion close,which will lead to DetachedInstanceError HOT 8
- [feature request] Custom login page HOT 1
- Page size selection at bottom sometimes takes the user to non existing page
- Ckeditor <TypeError: Cannot convert undefined or null to object> HOT 1
- Specify particular column to be searched. HOT 1
- sqlalchemy column_property should be ignore when create/update HOT 10
- Internationalization and Localization support HOT 1
- Datetime with timezone edited incorrectly HOT 1
- Image corruption when editing other fields HOT 2
- Adding custom filtering for relationships ModelConverterBase._prepare_select_options
- Redirect to custom url after creation HOT 1
- Support for pgvector.sqlalchemy.vector.VECTOR field support HOT 1
- Document update may be required to resolve DeprecationWarning from Starlette HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sqladmin.