If by chance someone is dealing with the same problem and using nginx,
here's a temporary fix: edit your virtual host configuration, and add this
lines inside the server {} block directive:
location /appname/ {
rewrite ^/appname/(.*)$ $scheme://mydomain.com/$1 redirect;
}
El jueves, 23 de abril de 2015, 15:57:57 (UTC-3), Lisandro escribió:
>
> I could get it to work, however I'm still concerned about something.
> This is what I have and it is working:
>
> session.connect(request, response, db=db, masterapp='init')
> response.cookies[response.session_id_name]['domain'] = 'website.com'
>
> As I said before, the two apps were renamed, keeping the database.
> So, regardless the new applications names, the session table is still
> named "web2py_session_init", and that's why I think it is working with
> masterapp='init'.
>
> However, should I be worried about setting masterapp with an app that
> doesn't exist? The book says "If you want two or more applications to share
> sessions, set masterapp to the name of the master application.", but I
> coundn't find specifications about if that app should exist or not.
>
> El jueves, 23 de abril de 2015, 11:36:42 (UTC-3), Lisandro escribió:
>>
>> I have two apps running on production: "init" app, and "panel" app.
>> Both of them are using the same database (symlinked models and databases
>> folder).
>> The sessions are stored in the db.
>> The main app is "init", so I'm connecting to session like this:
>>
>> session.connect(request, response, db=db, masterapp='init')
>>
>> In the database, I can see that the session table is called
>> "web2py_session_init".
>>
>>
>> Now I need to rename both apps and serve both of them on domaind and
>> subdomain, so I did this:
>> - renamed "init" to "*website*"; the app is now served on *website.com
>> <http://website.com>* domain.
>> - renamed "panel" to "*website_panel*"; the app is now served on
>> *panel.website.com
>> <http://panel.website.com>* domain
>>
>> The main app now is "website_panel".
>>
>> In order to mantain sessions through main domain and subdomain, I added
>> this sentence after the session.connect, so I ended up with this:
>> session.connect(request, response, db=db, masterapp='init')
>> response.cookies[response.session_id_name]['domain'] = 'website.com'
>>
>> But I'm receiving this error:
>>
>> Traceback (most recent call last):
>> File "/home/gonguinguen/medios/gluon/restricted.py", line 227, in
>> restricted
>> exec ccode in environment
>> File "/home/gonguinguen/medios/applications/website/models/db.py"
>> <http://fundapres.dev/admin/edit/fundapres/models/db.py>, line 10, in
>> <module>
>> response.cookies[response.session_id_name]['domain'] = 'website.com'
>> KeyError: 'session_id_init'
>>
>>
>>
>> First thing I tryied was to change masterapp parameter value, like this:
>> session.connect(request, response, db=db, masterapp='website_panel')
>> response.cookies[response.session_id_name]['domain'] = 'website.com'
>>
>> but in this case, an error is raised saying that the table
>> "web2py_session_website_panel" doesn't exists.
>> I'm not shure why web2py doesn't create the table. I have migrations
>> enabled,
>>
>>
>> I also tryied manually renaming the table and the corresponding file
>> under databases folder, but in this case I receive the following error:
>>
>> Traceback (most recent call last):
>> File "/home/gonguinguen/medios/gluon/restricted.py", line 227, in
>> restricted
>> exec ccode in environment
>> File "/home/gonguinguen/medios/applications/website/models/db.py"
>> <http://fundapres.dev/admin/edit/fundapres/models/db.py>, line 8, in <module>
>> response.cookies[response.session_id_name]['domain'] = 'website.com'
>> KeyError: 'session_id_website_panel'
>>
>>
>>
>> Also tryied deleting the old session table and the corresponding file
>> under databases folder, but in this case again I receive an error saying
>> that the table "web2py_session_website_panel" doesn't exists. So I'm
>> stucked here. Any tip? Thanks in advance.
>>
>>
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.