How do I stop getting ImportError: Could not import settings 'mofin.settings' when using django with wsgi?

前端 未结 15 1996
渐次进展
渐次进展 2020-12-04 11:15

I can\'t get wsgi to import my settings file for my project \'mofin\'.

The list of errors from the apache error log are as follows

mod_wsgi (pid=4001         


        
15条回答
  •  难免孤独
    2020-12-04 11:44

    I had a similar problem, solved it with the following snippet in my python:

    ALLDIRS = ['/var/www/MarkerDB/']
    
    import sys 
    import site 
    
    # Remember original sys.path.
    prev_sys_path = list(sys.path) 
    
    # Add each new site-packages directory.
    for directory in ALLDIRS:
      site.addsitedir(directory)
    
    # Reorder sys.path so new directories at the front.
    new_sys_path = [] 
    for item in list(sys.path): 
        if item not in prev_sys_path: 
            new_sys_path.append(item) 
            sys.path.remove(item) 
    sys.path[:0] = new_sys_pat
    

    Source: http://code.google.com/p/modwsgi/wiki/VirtualEnvironments#Application_Environments

提交回复
热议问题