Hiya, I've just upgraded and I had custom urls, but there doesn't seem to be a place to customise that now - was it routing.py?
I've had a complete memory blank - can anyone help?
Search Forums
6 posts Started 12 years ago by nms Latest reply from Nathan Wright
Hiya, I've just upgraded and I had custom urls, but there doesn't seem to be a place to customise that now - was it routing.py?
I've had a complete memory blank - can anyone help?
Yep just see mediacore/config/routing.py, the format will be the same as in v0.8.2 so it should be familiar. Let me know if you have any troubles.
All I want to do is point /custompage to custompage.html (in the Media folder where the explore & index & view htmls are), but I'm not sure what code to use...I keep getting syntax errors!
Just drop a custompage.html file in your mediacore/public/ directory and it'll be accessible at http://site.com/mediacore/custompage.html
If you really want to drop the .html extension you can set up an Apache Alias to point /custompage to that file specifically, assuming you've deployed with Apache + mod_wsgi/fastcgi of course. This would go alongside your WSGIScriptAlias or fastcgi setup:
Alias /custompage /full/path/to/your/custompage.html
Hi Nathan,
Thanks for the response. Last time, I'm pretty sure I edited some py file so I could access site.com/custompage.html by going to site.com/custompage(.html) as it was stored in mediacore/templates/media
Add this to mediacore/config/routing.py:
map.connect('/custompage', controller='media', action='custompage')
Then add this to the bottom of mediacore/controllers/media.py:
# Make sure it's indented as it is here
@expose()
def custompage(self, **kwargs):
path = os.path.join(config['here'], 'mediacore/public/custompage.html')
app = FileApp(path)
return forward(app)
That'll do the trick.
You must log in to post.