WebFaction
Community site: login faq

I have gone throught httpd.conf a dozen times and I cannot figure out how to get rid of the index.py. The app works but if I set an Alias o WSGI Alias it will still redirect to index.py and return a http 404.

I couldn't find any .ht... file anywhere in the webapp. When I stop the apache I get a http 502 - Bad Gateway but get still redirected to index.py.

  • Application: mod_wsgi 4.5.24/Python 3.6
  • virtual environment: NO

httpd.conf:

ServerRoot "/home/markusbarth/webapps/edf_checker/apache2"

LoadModule authz_core_module modules/mod_authz_core.so
LoadModule dir_module        modules/mod_dir.so
LoadModule env_module        modules/mod_env.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule mime_module       modules/mod_mime.so
LoadModule rewrite_module    modules/mod_rewrite.so
LoadModule setenvif_module   modules/mod_setenvif.so
LoadModule wsgi_module       modules/mod_wsgi.so
LoadModule unixd_module      modules/mod_unixd.so
LoadModule alias_module      modules/mod_alias.so

LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
CustomLog /home/markusbarth/logs/user/access_edf_checker.log combined
ErrorLog /home/markusbarth/logs/user/error_edf_checker.log

DirectoryIndex index.py
DocumentRoot /home/markusbarth/webapps/edf_checker/htdocs

Listen 12554
KeepAlive Off
SetEnvIf X-Forwarded-SSL on HTTPS=1
ServerLimit 1
StartServers 1
MaxRequestWorkers 5
MinSpareThreads 1
MaxSpareThreads 3
ThreadsPerChild 5

WSGIDaemonProcess edf_checker processes=2 threads=12 python-path=/home/markusbarth/webapps/edf_checker/lib/python3.6
WSGIProcessGroup edf_checker
WSGIRestrictEmbedded On
WSGILazyInitialization On

<Directory /home/markusbarth/webapps/edf_checker/htdocs>
    Options +ExecCGI
    AddHandler wsgi-script .py
    RewriteEngine On
    RewriteBase /
    WSGIScriptReloading On
</Directory>

WSGIScriptAlias / /home/markusbarth/webapps/edf_checker/htdocs/index.py/

index.py

import sys
sys.path.insert(0,'/home/markusbarth/webapps/edf_checker/htdocs/')
from edf_checker import app as application

asked 06 Feb, 09:10

markusbarth
1115
accept rate: 0%

edited 06 Feb, 10:48


It seems to be something built into flask, there is a good suggestion on stackoverflow to change it to init.py,

permanent link

answered 06 Feb, 22:20

johns ♦♦
5.3k212
accept rate: 23%

The issue on stackoverflow actually refers to a different problem caused by a wrong name for the package initializer init.py

(13 Feb, 13:17) markusbarth

I had the exact same problem (both with using WSGIScriptAlias and the alias module). My clue was from your comment that even stopping Apache resulted in the browser still trying to get to domain.com/index.py/

I realized that the problem was with the browser cache and I needed to shutdown and restart the browser. Once I did this everything worked as expected (no /index.py/ after the domain name in the browser URL). Interestingly this worked for Firefox, but not Chrome. Even restarting Chrome had the old domain URL cached. I had to specifically clear the browsing data (under more tools) to get it to work.

Hope this helps!

permanent link

answered 22 Jul, 11:41

PJB14
111
accept rate: 0%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×62
×44
×1

question asked: 06 Feb, 09:10

question was seen: 531 times

last updated: 22 Jul, 11:41

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2016 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM