Skip to content
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

Can't configure custom url path for flask admin installation #1837

Open
alfredfrancis opened this issue Mar 29, 2019 · 3 comments
Open

Can't configure custom url path for flask admin installation #1837

alfredfrancis opened this issue Mar 29, 2019 · 3 comments

Comments

@alfredfrancis
Copy link

Hi,
I have flask admin app running under my domain http://10.8.10.22:8080/identity/ which is routed by Traefik.
here is my configuration for the app

admin = admin.Admin(app,'Admin',url="/identity/admin")

when i access http://10.8.10.22:8080/identity/admin i get 404. But it's accessible under http://10.8.10.22:8080/identity/identity/admin/ but with broken static file links.
I tried different combinations of url and static_url_path , nothing seems to be working properly.

Can you help me resolve this ?

@ClintOxx
Copy link

try
admin = admin.Admin(app,'Admin',url="/admin")

@alfredfrancis
Copy link
Author

alfredfrancis commented Apr 1, 2019

@ClintOxx : i did that. now the URL is http://localhost/identity/admin/. All the styles and links are broken.
Here is the HTML output. here the links are supposed to be /identity/admin/role/ not /admin/role/

  |  
-- | --
  | <!DOCTYPE html>
  | <html>
  | <head>
  | <title>Home - Admin</title>
  |  
  | <meta charset="UTF-8">
  | <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  | <meta name="viewport" content="width=device-width, initial-scale=1.0">
  | <meta name="description" content="">
  | <meta name="author" content="">
  |  
  |  
  | <link href="/admin/static/bootstrap/bootstrap2/swatch/default/bootstrap.min.css?v=2.3.2" rel="stylesheet">
  | <link href="/admin/static/bootstrap/bootstrap2/css/bootstrap-responsive.css?v=2.3.2" rel="stylesheet">
  | <link href="/admin/static/admin/css/bootstrap2/admin.css?v=1.1.1" rel="stylesheet">
  |  
  | <style>
  | body {
  | padding-top: 4px;
  | }
  | </style>
  | </head>
  | <body>
  |  
  | <div class="container">
  | <div class="navbar">
  | <div class="navbar-inner">
  |  
  | <a class="brand" href="/admin">Admin</a>
  |  
  |  
  | <ul class="nav">
  |  
  |  
  | <li class="active">
  | <a href="/admin/">Home</a>
  | </li>
  | <li>
  | <a href="/admin/user/">User</a>
  | </li>
  | <li>
  | <a href="/admin/role/">Role</a>
  | </li>
  | <li>
  | <a href="/admin/status/">Status</a>
  | </li>
  | <li>
  | <a href="/admin/subscription/">Subscription</a>
  | </li>
  |  
  | </ul>
  | <ul class="nav pull-right">
  | </ul>
  |
  | </div>
  | </div>

  | </div>

  | <script src="/admin/static/vendor/jquery.min.js?v=2.1.4" type="text/javascript"></script>
  | <script src="/admin/static/bootstrap/bootstrap2/js/bootstrap.min.js?v=2.3.2" type="text/javascript"></script>
  | <script src="/admin/static/vendor/moment.min.js?v=2.9.0" type="text/javascript"></script>
  | <script src="/admin/static/vendor/select2/select2.min.js?v=3.5.2" type="text/javascript"></script>

  | </body>
  | </html>

@ClintOxx
Copy link

ClintOxx commented Apr 2, 2019

Do you have like a folder tree or something to i can see where these files lay in relation to this html template?

usually if im using the jinga templates i use {{ url_for('apis.upvote_key') }}

and in the upvote_key route i would return
render_template('upvote.html') which points at the location of the template.

its been awhile since ilook into how flask-admin handles links to templates but it should be the same

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants