Quantcast

cherrypy + jinja2 html template question: a href tag cannot go correct web page

Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

cherrypy + jinja2 html template question: a href tag cannot go correct web page

闫旭
Hello, i m a newbie of cherrypy

i have a jinja2 html template:

<li> <a href="{{ link }}">{{ descript}}</a></li>


when i run the server the link is like: 127.0.0.1/XXXXXXX


how can i get rid of the 127.0.0.1 ? 


thank in advance!

--
You received this message because you are subscribed to the Google Groups "cherrypy-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/cherrypy-users.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: cherrypy + jinja2 html template question: a href tag cannot go correct web page

Tim Roberts
闫旭 wrote:

> Hello, i m a newbie of cherrypy
>
> i have a jinja2 html template:
>
> <li><ahref="{{ link }}">{{ descript}}</a></li>
>
> when i run the server the link is like: 127.0.0.1/XXXXXXX
>
> how can i get rid of the 127.0.0.1 ?
>

This is not a CherryPy question, it is a Jinja2 question.  You need to
ask the Jinja2 list.

However, assuming you were running this on your local system,
http://127.0.0.1/XXXXXXX is entirely correct as an absolute URL.  If you
want the url to be relative instead of absolute, then you need to fix
the "link" variable before you pass it to Jinja.

--
Tim Roberts, [hidden email]
Providenza & Boekelheide, Inc.

--
You received this message because you are subscribed to the Google Groups "cherrypy-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/cherrypy-users.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: cherrypy + jinja2 html template question: a href tag cannot go correct web page

Eugen Hildt
If i understand you correctly you want to set 127.0.0.1 to another ip.
This is done by setting the config file or you can do it like this

cherrypy.config.update({'server.socket_host': '64.72.221.48',
                       
'server.socket_port': 80,
                       
})

I recommend you to read the documentation here http://docs.cherrypy.org/en/latest/config.html  


Am Freitag, 23. Oktober 2015 19:41:48 UTC+2 schrieb Tim Roberts:
闫旭 wrote:

> Hello, i m a newbie of cherrypy
>
> i have a jinja2 html template:
>
> <li><ahref="{{ link }}">{{ descript}}</a></li>
>
> when i run the server the link is like: <a href="http://127.0.0.1/XXXXXXX" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2F127.0.0.1%2FXXXXXXX\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFr35iEkw-VagTznaiP19h15JLlOA&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2F127.0.0.1%2FXXXXXXX\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFr35iEkw-VagTznaiP19h15JLlOA&#39;;return true;">127.0.0.1/XXXXXXX
>
> how can i get rid of the 127.0.0.1 ?
>

This is not a CherryPy question, it is a Jinja2 question.  You need to
ask the Jinja2 list.

However, assuming you were running this on your local system,
<a href="http://127.0.0.1/XXXXXXX" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2F127.0.0.1%2FXXXXXXX\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFr35iEkw-VagTznaiP19h15JLlOA&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2F127.0.0.1%2FXXXXXXX\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFr35iEkw-VagTznaiP19h15JLlOA&#39;;return true;">http://127.0.0.1/XXXXXXX is entirely correct as an absolute URL.  If you
want the url to be relative instead of absolute, then you need to fix
the "link" variable before you pass it to Jinja.

--
Tim Roberts, <a href="javascript:" target="_blank" gdf-obfuscated-mailto="l9onjbTtAAAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">ti...@...
Providenza & Boekelheide, Inc.

--
You received this message because you are subscribed to the Google Groups "cherrypy-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/cherrypy-users.
For more options, visit https://groups.google.com/d/optout.
Loading...