Error While Deploying Django On Apache
Solution 1:
The problem is that you are importing your app ("main") as if it lives directly on the Python path, and your URLconf ("therap.urls") as if it lives within a "therap" module on the Python path. This can only work if both "D:/therap" and "D:/therap/therap" are BOTH on the Python path (which runserver does for you automatically to "make things easy"; though it ends up just delaying the confusion until deployment time). You can emulate runserver's behavior by using the following line in your Apache config:
PythonPath "['D:/therap', 'D:/therap/therap'] + sys.path"
It probably makes more sense to standardize your references so your Python path only need include one or the other. The usual way (at least the way I see referenced more often) would be to put "D:\therap" on the Python path and qualify your app as "therap.main" instead of just "main". Personally, I take the opposite approach and it works just fine: put "D:\therap\therap" on your Python path and set ROOT_URLCONF to "urls" instead of "therap.urls". The advantage of this is that if in future you want to make your "main" app reusable and move it out of the particular project, your references to it aren't tied to the project name "therap" (though with an app named "main" it doesn't sound like you're thinking in terms of reusable apps anyway).
Post a Comment for "Error While Deploying Django On Apache"