-2

I have a (very) simple flask app hosted on open-shift.

It has one route:

@app.route('/')
def display_content():
    return render_template("content.html.jnj2")

and a simple wsgi file (as described in the open-shift flask setup tutorial):

from wsgiref.simple_server import make_server

httpd = make_server('localhost', 8051, application)
httpd.serve_forever()

This works fine when I navigate to "myappname-mydomain.rhcloud.com", but gives an "ERR_NAME_NOT_RESOLVED" when I navigate to "www.myappname-mydomain.rhcloud.com".

I've done some googling etc, can't see anyone else with a similar problem.. I'm not aware of having changed any open-shift settings or anything.

McDuffin
  • 558
  • 4
  • 9
  • Also I tried naively aliasing (via the open-shift website) www.myappname-mydomain.rhcloud.com to myappname-mydomain.rhcloud.com, but that gives a "The specified alias is not allowed: ... " error – McDuffin Nov 06 '15 at 17:18
  • 4
    This has nothing to do with flask or python. You can modify your dns settings on your nameserver to send www.example.com and example.com to the same IP address. Or you could put a wildcard setting in your DNS and tell your webserver (Apache, Nginx, etc..) what to do about redirecting one to the other. – Dan Safee Nov 06 '15 at 19:57
  • As I said, this is an app hosted on open-shift. Your comment misses the point - see the answer below – McDuffin Nov 06 '15 at 22:22
  • And if what I've done doesn't give the result I expect, including the relevant code and context is not unreasonable – McDuffin Nov 06 '15 at 22:26
  • (although yes I shouldn't have included the suggested 'python' tag) – McDuffin Nov 06 '15 at 22:38

1 Answers1

3

Your app-domain.rhcloud.com address that is provided by OpenShift does NOT include a cname for www.app-domain.rhcloud.com, that's why it's not working. You can use your app-domain.rhcloud.com, or you can map your own alias like example.com or www.example.com using this guide: https://developers.openshift.com/en/managing-domains-ssl.html#using-a-custom-domain

  • I thought that might be the case, but going by eg [this answer](http://stackoverflow.com/a/23307678/3832080) I thought it unlikely – McDuffin Nov 06 '15 at 22:25