Hi, I was trying to combine the two applications but failed because of the requirement of the project I couldn't combine the two rules ( ^/mat/(.*) and (^/testsuite/tests/[a-z0-9][a-z0-9\-]*(\.[a-z0-9][a-z0-9\-]* )+_[A-Z0-9][A-Z0-9_\-]*)/(.*\.fmp4)/(.*)$) in one perl regular expression, and also I found using "Alias" to filter out the files I don't want to touch is unrealistic (too many different type of files)
But finally I found solution from the following post. yeah..:) http://stackoverflow.com/questions/5969669/multiple-django-sites-on-apache-windows-mod-wsgi-problem-with-win32 Thanks for all your help!, Your blogs are very useful. Best regards, Monica On Thu, Oct 23, 2014 at 10:33 AM, Graham Dumpleton < [email protected]> wrote: > Have a read of: > > http://blog.dscpl.com.au/2014/09/hosting-php-web-applications-in.html > > http://code.google.com/p/modwsgi/wiki/ConfigurationGuidelines#The_Apache_Alias_Directive > > You can make Apache match actual physical files in the file system first > and only send URLs that don't match through to a WSGI application. > > There is also a mod_wsgi directive one can use such that even when a > physical file is matched of a certain type, rather than it be served up by > Apache, then the reference to it will be passed into a specified WSGI > application instead. You can detect this case in the WSGI environ and then > have the WSGI application read the file in and use it as input for the > request and produce the response. > > So have a read of those two docs and then perhaps explain a little bit > clearer what your requirements are if that doesn't satisfy them. > > Graham > > On 23/10/2014, at 8:19 PM, Yikang Mao <[email protected]> wrote: > > Hi Graham, > > Really thanks for your quick response. > > Yes, you are right and I missed "[", it is a paste mistake > > Yes, I totally agree with you, I want to avoid use this complex thing. It > is ok for me to combine the two applications to one, then handle the > pattern of URL inside the application. But I still have the problem for > filtering the files I need to deal with. For example, there are other > files e.g. html page, php script etc. under > /testsuite/tests/sub_folder/sub_folder which I don't want to touch, I am > only interested in the requests matching pattern either "mth" or > "^/testsuite/tests/[a-z0-9][a-z0-9\-]*(\.[a-z0-9][a-z0-9\-]*)+_[A-Z0-9][A-Z0-9_\-]*)/(.*\.fmp4)/(.*)$", > the first one is easy, the second is kind of mixed with the files I don't > want to handle. Because for so many reasons, I couldn't put the files into > separate folders. > > Before I thought I can use WSGIScriptAliasMatch to do the filter, but it > seems I cannot do it on windows. I tried to upgrade pywin32 package, it > does not help:(. > > Given "Alias" or "AliasMatch" has precedence over WSGIScriptAlias, Now I > am thinking possibly I use the them to filter out the files I am not > interested in, then the rest of the files will go to the django > application, hopping I can find easy pattern to do this filter ( I hate the > perl regular expression :(). > > Really thanks for your help!! > > Best regards, > Monica. > > > On Wed, Oct 22, 2014 at 11:33 PM, Graham Dumpleton < > [email protected]> wrote: > >> >> On 23/10/2014, at 1:36 AM, Yikang Mao <[email protected]> wrote: >> >> HI, >> >> I am working on a project which have three parts >> >> 1: Website to make user configure something which is handled by a django >> app, config.wsgi >> 2: Serve the segment files for MPEG Dash which is handled by another >> django app, mpegdash.wsgi >> 3: Static resources. >> >> I use the following configuration >> ------------------------------------------------------------ >> DocumentRoot "C:/xampp/htdocs" >> Alias /mat_static/ "E:/Work/MAT/static_web_files/" >> >> WSGIScriptAlias /mth "E:/Work/mat/config.wsgi" >> WSGIScriptAliasMatch >> ^/testsuite/tests/a-z0-9][a-z0-9\-]*(\.[a-z0-9][a-z0-9\-]*)+_[A-Z0-9][A-Z0-9_\-]*)/(.*\.fmp4)/(.*)$ >> "E:/Work/MAT/mpegdash.wsgi" >> ---------------------------------------------------- >> >> >> Your pattern doesn't appear to be valid. I don't know if you simply cut >> and paste it wrong. There is a missing opening '[' on the first character >> class match 'a-z0-9'. >> >> In general you have to be very careful in using WSGIScriptAliasMatch and >> I would always recommend against it if you can. >> >> Why can't you just have: >> >> WSGIScriptAlias / testsuite/tests "E:/Work/MAT/mpegdash.wsgi" >> >> and have the script internally do pattern match on PATH_INFO and reject >> with a 404 if not matching. >> >> Now the problem is that only one instance of django can work, e.g. if I >> firstly perform the request for config.wsgi and it works, then any requests >> matching the second one will fail. If I perform a request e.g. >> http://mat.test/testsuite/test/mat.test_1050/720x576i_1000Kbps_3secseg_MP30_169/media.fmp4/video/1/init.mp4 >> matching the rules for mpegdash.wsgi and it works, but any requests other >> than the request even it match the rule for config.wsgi or mpegdash.wsgi >> will fail. All the error is the same " File >> "C:\Python27\lib\site-packages\win32\lib\pywintypes.py", line 114, in >> __import_pywin32_system_module__ >> >> assert sys.modules[modname] is old_mod, AssertionError" >> >> I was thinking that using WSGIDaemonProcess and soon found it is not >> supported on windows >> >> Could someone tell what is the real problem for this? any suggestion for >> apache configuration? >> >> >> Anyway, for a start, have a read of: >> >> >> http://blog.dscpl.com.au/2012/10/requests-running-in-wrong-django.html >> >> For multiple Django instances in same process, you need to make sure your >> Django wsgi.py is using: >> >> os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite.settings' >> >> and not: >> >> os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'mysite.settings') >> >> else the wrong config will be used. >> >> The other possibility is that this win32 module you are using can only be >> used in one Python sub interpreter of a process at a time. Since you are >> using Django though, you cannot force the two to run together in one sub >> interpreter and you don't have daemon mode available. >> >> Lets check how those Django settings modules are setup first though. >> >> Graham >> >> >> >> >> -- >> You received this message because you are subscribed to a topic in the >> Google Groups "modwsgi" group. >> To unsubscribe from this topic, visit >> https://groups.google.com/d/topic/modwsgi/eO4s3sobo-U/unsubscribe. >> To unsubscribe from this group and all its topics, send an email to >> [email protected]. >> To post to this group, send email to [email protected]. >> Visit this group at http://groups.google.com/group/modwsgi. >> For more options, visit https://groups.google.com/d/optout. >> > > > -- > You received this message because you are subscribed to the Google Groups > "modwsgi" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/modwsgi. > For more options, visit https://groups.google.com/d/optout. > > > -- > You received this message because you are subscribed to a topic in the > Google Groups "modwsgi" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/modwsgi/eO4s3sobo-U/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/modwsgi. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "modwsgi" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/modwsgi. For more options, visit https://groups.google.com/d/optout.
