[google-appengine] Re: typical scenario
I guess you can use the import statement in the other directories to access anything from DB floder lets say if you have models.py in DB folder contains your data model classes then in the other directories you can access it by from DB import models On Mon, Jan 12, 2009 at 9:09 AM, arnie wrote: > > Hi all > I have three folders > BusinessList > Conversion > DB > > First two folders contains one WSGI app [no UI] each. The last folder > contains a datta model [2 tables with 1- to Many relationship] > Each WSGI app accesses the data model in DB folder. My problem is that > If I place the data model file in DB folder then none of the wsgi app > is able to locate it. If I copy the datamodel file in each of the wsgi > folder, it works > My urgent requirement is to access the data model file in DB folder? > What should I do? > All the three folders are in C:\APP\ > > > > -- cheers Gipsy --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Google App Engine" group. To post to this group, send email to google-appengine@googlegroups.com To unsubscribe from this group, send email to google-appengine+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en -~--~~~~--~~--~--~---
[google-appengine] Re: typical scenario
Try adding an empty __init__.py file into your DB folder. This marks the DB folder as a 'package' and allows you to import modules from it. More info at: http://www.python.org/doc/2.5.2/tut/node8.html On Jan 13, 2:09 am, arnie wrote: > Hi all > I have three folders > BusinessList > Conversion > DB > > First two folders contains one WSGI app [no UI] each. The last folder > contains a datta model [2 tables with 1- to Many relationship] > Each WSGI app accesses the data model in DB folder. My problem is that > If I place the data model file in DB folder then none of the wsgi app > is able to locate it. If I copy the datamodel file in each of the wsgi > folder, it works > My urgent requirement is to access the data model file in DB folder? > What should I do? > All the three folders are in C:\APP\ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Google App Engine" group. To post to this group, send email to google-appengine@googlegroups.com To unsubscribe from this group, send email to google-appengine+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en -~--~~~~--~~--~--~---
[google-appengine] Re: typical scenario
I have tried both the method of import statement and __init__.py file also created the PYTHONPATH variable in system settings [windows xp] and given even the path C:\App\DB\ but it is not working What i am be able to understand is that the python runtime is not able to find the folder DB --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Google App Engine" group. To post to this group, send email to google-appengine@googlegroups.com To unsubscribe from this group, send email to google-appengine+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en -~--~~~~--~~--~--~---
[google-appengine] Re: typical scenario
I am stuck in a very big problem and could not find any solution for this Writing import DB in the BusinessList folder's businesslist.py file does not work. I have also added __init__.py file [empty] in the DB folder but of no use. Also I have created PYTHONPATH environment variable and gives it the path "C:/" but it seems to me that this setting is not working too. I have to upload this folder structure to GAE under one AppID Can anybody suggest a solution? Thanks --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Google App Engine" group. To post to this group, send email to google-appengine@googlegroups.com To unsubscribe from this group, send email to google-appengine+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en -~--~~~~--~~--~--~---
[google-appengine] Re: typical scenario
I really don't know much about WSGI, but this works for me. As I understand it, you should probably have 1 WSGI app in the "root" folder. It will do whatever's appropriate to load whichever "sub-app" needs to run. Then they should both be able to import from the DB folder. i.e. / -- app.yaml | main.py + app_one | __init__.py | whatever.py + app_two | __init__.py | whatever.py + DB | __init__.py | model_one.py | model_two.py | model_three.py Set up app.yaml to dispatch requests to main.py (or whatever you want to call it). Have it examine REQUEST and dispatch into app_one or app_two as needed (`import app_one.whatever`). Then files in app_one or app_two should be able to `import DB.model_one` If it's anything more than a dead-simple app, I'd break it down further than that. But that's the idea I'm using. On Jan 14, 8:29 am, arnie wrote: > I am stuck in a very big problem and could not find any solution for > this > Writing import DB in the BusinessList folder's businesslist.py file > does not work. I have also added __init__.py file [empty] in the DB > folder but of no use. Also I have created PYTHONPATH environment > variable and gives it the path "C:/" but it seems to me that this > setting is not working too. I have to upload this folder structure to > GAE under one AppID > Can anybody suggest a solution? > Thanks --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Google App Engine" group. To post to this group, send email to google-appengine@googlegroups.com To unsubscribe from this group, send email to google-appengine+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en -~--~~~~--~~--~--~---
[google-appengine] Re: typical scenario
http://groups.google.com/group/google-appengine/browse_thread/thread/2baa48709bb94bd3?hl=en has an excellent answer about dispatching to multiple WSGI apps. On Jan 17, 12:11 pm, James Ashley wrote: > I really don't know much about WSGI, but this works for me. > > As I understand it, you should probably have 1 WSGI app in the "root" > folder. It will do whatever's appropriate to load whichever "sub-app" > needs to run. Then they should both be able to import from the DB > folder. > > i.e. > > / -- app.yaml > | main.py > + app_one > | __init__.py > | whatever.py > + app_two > | __init__.py > | whatever.py > + DB > | __init__.py > | model_one.py > | model_two.py > | model_three.py > > Set up app.yaml to dispatch requests to main.py (or whatever you want > to call it). Have it examine REQUEST and dispatch into app_one or > app_two as needed (`import app_one.whatever`). > > Then files in app_one or app_two should be able to `import > DB.model_one` > > If it's anything more than a dead-simple app, I'd break it down > further than that. But that's the idea I'm using. > > On Jan 14, 8:29 am, arnie wrote: > > > I am stuck in a very big problem and could not find any solution for > > this > > Writing import DB in the BusinessList folder's businesslist.py file > > does not work. I have also added __init__.py file [empty] in the DB > > folder but of no use. Also I have created PYTHONPATH environment > > variable and gives it the path "C:/" but it seems to me that this > > setting is not working too. I have to upload this folder structure to > > GAE under one AppID > > Can anybody suggest a solution? > > Thanks --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Google App Engine" group. To post to this group, send email to google-appengine@googlegroups.com To unsubscribe from this group, send email to google-appengine+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en -~--~~~~--~~--~--~---