Jump to content


Photo

Flask app on subdomain.

flask subdomain

  • Please log in to reply
4 replies to this topic

#1 patents

patents

    Rank II Member

  • Members
  • PipPip
  • 84 posts
  • Gender:Male
  • Location:India
  • Interests:Python, Django

Posted 30 March 2018 - 09:34 AM

I am trying to deploy flask app on subdomain say testings.
 
this is my .htaccess.
 

RewriteEngine On
RewriteBase /
RewriteRule ^(media/.*)$ - [L]
RewriteRule ^(admin_media/.*)$ - [L]
RewriteRule ^(flask\.wsgi/.*)$ - [L]
RewriteRule ^(.*)$ flask/flask.wsgi/$1 [QSA,PT,L]
This is my flask.wsgi
 

import os, sys


# edit your username below
sys.path.append("/home/username/public_html/flask");


sys.path.insert(0, os.path.dirname(__file__))
from myapp import app as application


# make the secret code a little better
application.secret_key = '<removed>'
when I visit using user.heliohost.org/testings it works but when I visit using testings.user.heliohost.org it throws internal server error.

Edited by Krydos, 30 March 2018 - 06:00 PM.
removed key


#2 Krydos

Krydos

    Rank X Member

  • Root Admin
  • 16,484 posts
  • Gender:Male

Posted 30 March 2018 - 06:02 PM

# edit your username below
sys.path.append("/home/username/public_html/flask");

Did you change that line to match your username?

#3 patents

patents

    Rank II Member

  • Members
  • PipPip
  • 84 posts
  • Gender:Male
  • Location:India
  • Interests:Python, Django

Posted 31 March 2018 - 08:48 AM

Thanks. Sorry for not making it clear. I posted above sample from working example your provided in the original flask discussion which was working fine for me when I hosted at public_html/flask (by off course changing username). however when I created it as subdomain it was not working.

 

The reason I presume could be this line.

RewriteRule ^(.*)$ flask/flask.wsgi/$1 [QSA,PT,L]
Because, when I was visiting flask.patents.heliohost.org it was giving me error but when I visited patents.heliohost.org/flask it was working fine. I am not Apache guy. you can throw some light.
 
when I changed it to this:
 
RewriteRule ^(.*)$ flask.wsgi/$1 [QSA,PT,L]

Now patents.heliohost.org/flask is not working but flask.patents.heliohost.org is working.

 

 

 
Thanks

Edited by patents, 31 March 2018 - 10:37 AM.


#4 Krydos

Krydos

    Rank X Member

  • Root Admin
  • 16,484 posts
  • Gender:Male

Posted 31 March 2018 - 12:57 PM

One or the other is going to work when you change that line. You just need to pick.

#5 patents

patents

    Rank II Member

  • Members
  • PipPip
  • 84 posts
  • Gender:Male
  • Location:India
  • Interests:Python, Django

Posted 01 April 2018 - 03:56 PM

Thats fine with me.

 

Thanks.







Also tagged with one or more of these keywords: flask, subdomain

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users