From alex-alex-90 at wp.pl Sun Oct 9 18:11:09 2016 From: alex-alex-90 at wp.pl (Alex Alex) Date: Mon, 10 Oct 2016 00:11:09 +0200 Subject: [Flask] click and flask-script Message-ID: <57fac07dd00cb1.94275633@wp.pl> Hi I've came to a moment in my project when using flask-script makes sense however as I understand there is a click integration but it seems there is no clear consensus on how things will proceed in future according to this: https://github.com/smurfix/flask-script/issues/97 Therefor my question is following: shell I use flask-script (and can I use it safely for foreseeable future) or should I move to click? Cheers, Alex From eriksmejl at gmail.com Thu Oct 13 04:44:55 2016 From: eriksmejl at gmail.com (Erik Lindqvist) Date: Thu, 13 Oct 2016 10:44:55 +0200 Subject: [Flask] Flask 0.11.1, Werkzeug 0.11.11 and lighttpd fastcgi are not compatible Message-ID: Hi, I receive an error trying to run my Flask app via fastcgi: Status: 301 MOVED PERMANENTLY Luckily I found a SO question mentioning this: http://stackoverflow.com/questions/38174875/301-moved-permanently-with-python-fcgi The workaround is to downgrade Werkzeug from 0.11.11 to 0.9.6. My question is, has someone from the development side looked into this more? Right now it is not possible to run flask+lighttpd+fastcgi "out of the box", as suggested by the documentation. Regards, Erik -------------- next part -------------- An HTML attachment was scrubbed... URL: From eriksmejl at gmail.com Thu Oct 13 04:56:26 2016 From: eriksmejl at gmail.com (Erik Lindqvist) Date: Thu, 13 Oct 2016 10:56:26 +0200 Subject: [Flask] URL rewriting (url_for) issues with Flask 0.11.1 and fastcgi Message-ID: Hi, In my current setup I am using the following: * Flask 0.11.1 * Werkzeug-0.9.6 * flup 1.0.2 * lighttpd 1.4.41 ** mod_fastcgi I have followed the fastcgi instructions here: http://flask.pocoo.org/docs/0.11/deploying/fastcgi/#configuring-lighttpd My issue is that "url_for" is returning URLs with the following prefix: "/yourapplication.fcgi/actualpage" instead of "/actualpage" When running Flask's internal development server I do not have these issues at all. Anyone familiar with this issue? Regards, Erik -------------- next part -------------- An HTML attachment was scrubbed... URL: From badrihippo at gmail.com Thu Oct 13 05:21:40 2016 From: badrihippo at gmail.com (badrihippo at gmail.com) Date: Thu, 13 Oct 2016 14:21:40 +0500 Subject: [Flask] URL rewriting (url_for) issues with Flask 0.11.1 and fastcgi In-Reply-To: References: Message-ID: <1476350500.1654.0@smtp.gmail.com> I have this same issue, with Flask 0.10.1, Werkzeug 0.11.3 and mod_wsgi. I haven't found any solution yet. But I'm guessing this means it's a generic problem (not related to version)? The main problem is that the server directs it to that .fcgi or .wsgi file internally, but we don't want it to show that to the user. Django allows you to manually set the URL prefix; maybe there's a way to do this in Flask as well? ?Badri/Hippo -------------- next part -------------- An HTML attachment was scrubbed... URL: From sebastien.billion at gmail.com Thu Oct 13 07:52:51 2016 From: sebastien.billion at gmail.com (=?UTF-8?Q?S=C3=A9bastien_Billion?=) Date: Thu, 13 Oct 2016 13:52:51 +0200 Subject: [Flask] URL rewriting (url_for) issues with Flask 0.11.1 and fastcgi In-Reply-To: <1476350500.1654.0@smtp.gmail.com> References: <1476350500.1654.0@smtp.gmail.com> Message-ID: Can we see your lighthttpd conf file? 2016-10-13 11:21 GMT+02:00 : > I have this same issue, with Flask 0.10.1, Werkzeug 0.11.3 and mod_wsgi. I > haven't found any solution yet. But I'm guessing this means it's a generic > problem (not related to version)? > > > The main problem is that the server directs it to that .fcgi or .wsgi > file internally, but we don't want it to show that to the user. Django > allows you to manually set the URL prefix; maybe there's a way to do this > in Flask as well? > > ?Badri/Hippo > > > > _______________________________________________ > Flask mailing list > Flask at python.org > https://mail.python.org/mailman/listinfo/flask > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From eriksmejl at gmail.com Thu Oct 13 09:28:12 2016 From: eriksmejl at gmail.com (Erik Lindqvist) Date: Thu, 13 Oct 2016 15:28:12 +0200 Subject: [Flask] URL rewriting (url_for) issues with Flask 0.11.1 and fastcgi In-Reply-To: References: <1476350500.1654.0@smtp.gmail.com> Message-ID: Basically a copy of the fastcgi example from the docu, minus the port binding: $SERVER["socket"] == ":5000" { fastcgi.server = ("/yourapplication.fcgi" => (( "socket" => "/tmp/tti-app-fcgi.sock", "bin-path" => "/local/www/wwwroot/yourapplication/ yourapplication.fcgi", "check-local" => "disable", "max-procs" => 1 )) ) alias.url = ( "/static/" => "/local/www/wwwroot/yourapplication/static" ) url.rewrite-once = ( "^(/static($|/.*))$" => "$1", "^(/.*)$" => "/yourapplication.fcgi" ) } On Thu, Oct 13, 2016 at 1:52 PM, S?bastien Billion < sebastien.billion at gmail.com> wrote: > Can we see your lighthttpd conf file? > > 2016-10-13 11:21 GMT+02:00 : > >> I have this same issue, with Flask 0.10.1, Werkzeug 0.11.3 and mod_wsgi. >> I haven't found any solution yet. But I'm guessing this means it's a >> generic problem (not related to version)? >> >> >> The main problem is that the server directs it to that .fcgi or .wsgi >> file internally, but we don't want it to show that to the user. Django >> allows you to manually set the URL prefix; maybe there's a way to do this >> in Flask as well? >> >> ?Badri/Hippo >> >> >> >> _______________________________________________ >> Flask mailing list >> Flask at python.org >> https://mail.python.org/mailman/listinfo/flask >> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From karsten.goen at googlemail.com Thu Oct 13 16:57:15 2016 From: karsten.goen at googlemail.com (Karsten Goen) Date: Thu, 13 Oct 2016 22:57:15 +0200 Subject: [Flask] load different templates for mobile website Message-ID: hello together, first of all I do not want to use responsive webdesign, so I need two versions of my website since the mobile website shall become a easy controllable menu with collapsed menu entries. I am really stuck how do I tell flask that it should choose the templates out of the mobile folder when detecting a mobile device. I already tried this https://flask-mobility.readthedocs.io/en/latest/ which is very good until that point when you include templates into your templates. I think I more need some general loader like: when mobile version-> use this template folder (I would use the same template names). Would that be the direction to go? Another option would be to write a backend api and make two different flask-app for each type of website. I think it would not be a big deal when using blueprints on the other hand I would prefer one handler in my current app which is easy to load and easy to remove when things in the app change. What you people think? I am open to totally new ideas how to structure mobile / desktop website? What would be the best way without rewriting "anything". Cheers -------------- next part -------------- An HTML attachment was scrubbed... URL: From aresowj at gmail.com Fri Oct 14 08:54:41 2016 From: aresowj at gmail.com (Ares Ou) Date: Fri, 14 Oct 2016 05:54:41 -0700 Subject: [Flask] load different templates for mobile website In-Reply-To: References: Message-ID: >From the information you have provided, I guess you could just write a function receiving path string to return the path for any template you want to include. By request.MOBILE, this function can determine to return whether mobile or desktop template path for that particular template. For example: import os > from flask import request, app > def assemble_template_path(path): > if request.MOBILE: > return os.path.join(app.config['MOBILE_TEMPLATE_PREFIX'], path) > else: > # Do not append anything if it's on desktop > return path Best regards, Ares Ou *Software Engineer / Full-Stack Python Developer* *Blog:* http://aresou.net | *Github:* https://github.com/aresowj *Stack Overflow:* http://stackoverflow.com/users/5183727/ares-ou Ares Ou On Thu, Oct 13, 2016 at 1:57 PM, Karsten Goen via Flask wrote: > hello together, > first of all I do not want to use responsive webdesign, so I need two > versions of my website since the mobile website shall become a easy > controllable menu with collapsed menu entries. > I am really stuck how do I tell flask that it should choose the > templates out of the mobile folder when detecting a mobile device. I > already tried this https://flask-mobility.readthedocs.io/en/latest/ > which is very good until that point when you include templates into > your templates. I think I more need some general loader like: > when mobile version-> use this template folder (I would use the same > template names). Would that be the direction to go? > Another option would be to write a backend api and make two different > flask-app for each type of website. I think it would not be a big deal > when using blueprints on the other hand I would prefer one handler in > my current app which is easy to load and easy to remove when things in > the app change. > What you people think? I am open to totally new ideas how to structure > mobile / desktop website? What would be the best way without rewriting > "anything". > > > Cheers > > _______________________________________________ > Flask mailing list > Flask at python.org > https://mail.python.org/mailman/listinfo/flask > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From alex-alex-90 at wp.pl Mon Oct 17 09:16:36 2016 From: alex-alex-90 at wp.pl (Alex Alex) Date: Mon, 17 Oct 2016 15:16:36 +0200 Subject: [Flask] Adding search funcitonality to Flask Flatpages Message-ID: <5804cf34b9a0d5.24902847@wp.pl> Hi, Thank you all for all the help so far. I'm looking for a good way to add search functionality to content generated by Flask Flatpages extension. I could always inspect FlatPages object but maybe someone already did it and have different thoughts on the subject. As always I will be grateful for any tip. Best Regards, Alex From eriksmejl at gmail.com Mon Oct 17 13:42:58 2016 From: eriksmejl at gmail.com (Erik Lindqvist) Date: Mon, 17 Oct 2016 19:42:58 +0200 Subject: [Flask] URL rewriting (url_for) issues with Flask 0.11.1 and fastcgi In-Reply-To: References: <1476350500.1654.0@smtp.gmail.com> Message-ID: Hi, So I found a workaround, credit to http://stackoverflow.com/a/38662338 TL;DR SCRIPT_NAME has to be set to "" in the environment before passing the app to WSGI. So the issue seems to be that "SCRIPT_NAME" in the environment is wrong somehow. Does annyone know where I should find an issue? mod_fastcgi? Werkzeug? Flup? Flask? Also, I had to change the alias.url path to make sure the local path has a trailing "/". Static files can't be accessed otherwise, will submit a PR for the documentation. //Erik On Thu, Oct 13, 2016 at 3:28 PM, Erik Lindqvist wrote: > Basically a copy of the fastcgi example from the docu, minus the port > binding: > $SERVER["socket"] == ":5000" { > fastcgi.server = ("/yourapplication.fcgi" => > (( > "socket" => "/tmp/tti-app-fcgi.sock", > "bin-path" => "/local/www/wwwroot/yourapplication/ > yourapplication.fcgi", > "check-local" => "disable", > "max-procs" => 1 > )) > ) > alias.url = ( > "/static/" => "/local/www/wwwroot/yourapplication/static" > ) > url.rewrite-once = ( > "^(/static($|/.*))$" => "$1", > "^(/.*)$" => "/yourapplication.fcgi" > ) > } > > > On Thu, Oct 13, 2016 at 1:52 PM, S?bastien Billion < > sebastien.billion at gmail.com> wrote: > >> Can we see your lighthttpd conf file? >> >> 2016-10-13 11:21 GMT+02:00 : >> >>> I have this same issue, with Flask 0.10.1, Werkzeug 0.11.3 and mod_wsgi. >>> I haven't found any solution yet. But I'm guessing this means it's a >>> generic problem (not related to version)? >>> >>> >>> The main problem is that the server directs it to that .fcgi or .wsgi >>> file internally, but we don't want it to show that to the user. Django >>> allows you to manually set the URL prefix; maybe there's a way to do this >>> in Flask as well? >>> >>> ?Badri/Hippo >>> >>> >>> >>> _______________________________________________ >>> Flask mailing list >>> Flask at python.org >>> https://mail.python.org/mailman/listinfo/flask >>> >>> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From petef4+usenet at gmail.com Mon Oct 17 15:55:59 2016 From: petef4+usenet at gmail.com (Pete Forman) Date: Mon, 17 Oct 2016 20:55:59 +0100 Subject: [Flask] URL rewriting (url_for) issues with Flask 0.11.1 and fastcgi References: <1476350500.1654.0@smtp.gmail.com> Message-ID: Erik Lindqvist writes: > So I found a workaround, credit to http://stackoverflow.com/a/38662338 > TL;DR SCRIPT_NAME has to be set to "" in the environment before > passing the app to WSGI. > > So the issue seems to be that "SCRIPT_NAME" in the environment is > wrong somehow. > Does annyone know where I should find an issue? > mod_fastcgi? > Werkzeug? > Flup? > Flask? > > Also, I had to change the alias.url path to make sure the local path > has a trailing "/". Static files can't be accessed otherwise, will > submit a PR for the documentation. This Python code may help your diagnosis. I have used it to print command lines and environment up the calling tree on Linux. #!/usr/bin/env python from __future__ import print_function import os def print_pids_etc(): first = True for pid in get_ppids(os.getpid()): cmdline = get_cmdline(pid) env = get_env(pid) if first: first = False else: print print('PID: {0}'.format(pid)) print('COMMAND LINE:') print('\n'.join(cmdline) if cmdline else '(cmdline not readable)') print('ENVIRONMENT:') print('\n'.join(env) if env else '(environ not readable)') def get_ppid(pid): """Return the ppid for a pid. """ with open('/proc/{0}/stat'.format(pid)) as f: line = f.read() return int(line.split()[3]) def get_ppids(pid): """Return pid and all its ancestors. """ pids = [pid] failsafe = 100 while int(pid) > 1 and failsafe > 0: failsafe -= 1 pid = get_ppid(pid) pids.append(pid) return pids def get_cmdline(pid): """Return the command line for a process ID. Returns a list of command line argument (including 0th). If cmdline is not readable then return None. """ try: with open('/proc/{0}/cmdline'.format(pid)) as f: e = f.read() return e.rstrip('\0').split('\0') except IOError: return None def get_env(pid): """Return the environment for a process ID. Returns a sorted list of strings 'NAME=VALUE'. If environ is not readable then return None. """ try: with open('/proc/{0}/environ'.format(pid)) as f: e = f.read() return sorted(e.rstrip('\0').split('\0')) except IOError: return None if __name__ == '__main__': print_pids_etc() -- Pete Forman https://payg-petef.rhcloud.com From petef4+usenet at gmail.com Tue Oct 18 13:46:20 2016 From: petef4+usenet at gmail.com (Pete Forman) Date: Tue, 18 Oct 2016 18:46:20 +0100 Subject: [Flask] URL rewriting (url_for) issues with Flask 0.11.1 and fastcgi References: <1476350500.1654.0@smtp.gmail.com> Message-ID: Pete Forman writes: > This Python code may help your diagnosis. I have used it to print > command lines and environment up the calling tree on Linux. I dusted that code down a bit too quickly. Line 14 should have been print() rather than a bare print statement for Python 3 compatibility. -- Pete Forman https://payg-petef.rhcloud.com From eriksmejl at gmail.com Tue Oct 18 15:52:55 2016 From: eriksmejl at gmail.com (Erik Lindqvist) Date: Tue, 18 Oct 2016 19:52:55 +0000 Subject: [Flask] URL rewriting (url_for) issues with Flask 0.11.1 and fastcgi In-Reply-To: References: <1476350500.1654.0@smtp.gmail.com> Message-ID: Thanks for the suggestions Pete! However, just wanted to clarify that with "environment" I meant the WSGI environment. See https://github.com/pallets/flask/blob/master/flask/app.py#L1963 I am not sure how it is passed to Flask but my guess is that mod_fastcgi is passing it to Flask via Flup. Hence, the issue with SCRIPT_NAME being != "" might be due to mod_fastcgi (lighttpd). Anyone with lighttpd/fastcgi knowledge who can chime in? //Erik On Tue, Oct 18, 2016 at 7:47 PM Pete Forman wrote: > Pete Forman > writes: > > This Python code may help your diagnosis. I have used it to print > > command lines and environment up the calling tree on Linux. > > I dusted that code down a bit too quickly. Line 14 should have been > print() rather than a bare print statement for Python 3 compatibility. > > -- > Pete Forman > https://payg-petef.rhcloud.com > > _______________________________________________ > Flask mailing list > Flask at python.org > https://mail.python.org/mailman/listinfo/flask > -------------- next part -------------- An HTML attachment was scrubbed... URL: From luseiee at outlook.com Wed Oct 19 12:35:18 2016 From: luseiee at outlook.com (=?gb2312?B?wr0g0OyzrA==?=) Date: Wed, 19 Oct 2016 16:35:18 +0000 Subject: [Flask] Question about SSL certificate on custom domain Message-ID: Hello Everyone: I'm a beginner to web development. I followed Miguel Grinberg's book and develop the flasky blog system. I deployed it to Heroku. Now I bought a new domain name and resoluted the domain to my Heroku domain. When using the new domain, I found that it can't pass the SSL certification when using https. (Of course, the original Heroku URL is https enabled.) There's always a red cross on the URL in my Chrome browser. I bought a free CA from Symantec and got two files .key and .pem.. Can anybody tell me how to use these two files in my FLASK project and make the https function well? And one more question. When I run my project with http using my own domain name, the user login state can't last long. I frequently need to login again. When I run it in https in Heroku domain name, it works well. Is that because the browser refresh the cookies under unsafe http browsing? Before reading this book, I have barely no idea about web, HTTP, maybe the question is a little bit silly. I hope someone could help me. Thanks a lot! Lu 2016.10.19 -------------- next part -------------- An HTML attachment was scrubbed... URL: From aresowj at gmail.com Wed Oct 19 12:39:06 2016 From: aresowj at gmail.com (Ares Ou) Date: Wed, 19 Oct 2016 09:39:06 -0700 Subject: [Flask] Question about SSL certificate on custom domain In-Reply-To: References: Message-ID: Hi, I guess you should check out how to implement HTTPS on the web server. For example, Apache or Nginx. Of course the dev server in Flask also supports SSL if you set it up correctly. I did a brief search and found this snippet which might be helpful to you: http://flask.pocoo.org/snippets/111/ . Let me know if you have any question following this article. Thanks. Best regards, Ares Ou *Software Engineer / Full-Stack Python Developer* *Blog:* http://aresou.net | *Github:* https://github.com/aresowj *Stack Overflow:* http://stackoverflow.com/users/5183727/ares-ou Ares Ou On Wed, Oct 19, 2016 at 9:35 AM, ? ?? wrote: > Hello Everyone: > > > I'm a beginner to web development. > > > I followed Miguel Grinberg's book and develop the flasky blog system. I > deployed it to Heroku. > > > Now I bought a new domain name and resoluted the domain to my Heroku > domain. When using the new domain, I found that it can't pass the SSL > certification when using https. (Of course, the original Heroku URL is > https enabled.) There's always a red cross on the URL in my Chrome browser. > > > I bought a free CA from Symantec and got two files .key and .pem.. Can > anybody tell me how to use these two files in my FLASK project and make the > https function well? > > > And one more question. When I run my project with http using my own domain > name, the user login state can't last long. I frequently need to login > again. When I run it in https in Heroku domain name, it works well. Is that > because the browser refresh the cookies under unsafe http browsing? > > > Before reading this book, I have barely no idea about web, HTTP, maybe the > question is a little bit silly. > > > I hope someone could help me. > > > Thanks a lot! > > > Lu > > 2016.10.19 > > > > > _______________________________________________ > Flask mailing list > Flask at python.org > https://mail.python.org/mailman/listinfo/flask > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From luseiee at outlook.com Wed Oct 19 13:10:12 2016 From: luseiee at outlook.com (=?gb2312?B?wr0g0OyzrA==?=) Date: Wed, 19 Oct 2016 17:10:12 +0000 Subject: [Flask] =?gb2312?b?tPC4tDogIFF1ZXN0aW9uIGFib3V0IFNTTCBjZXJ0aWZp?= =?gb2312?b?Y2F0ZSBvbiBjdXN0b20gZG9tYWlu?= In-Reply-To: References: , Message-ID: Dear Ares Ou: Thanks a lot!! Your response is very helpful! I've read this article and I am still confused about several points. Suppose I deploy my flask project on example.herokuapp.com and bought a new domain my.com and resolute it to example.herokuapp.com. 1. In Production Environment, I'm told that it's not recommended to use app.run(), instead gunicorn is recommended, how to implement HTTPS on gunicorn? I've checked gunicorn's doc and I found that gunicorn has --keyfile and -certfile options. I suppose it will do the same thing, am I right? 2. The second question is a serious one. The certification I bought is binded to my.com. Suppose I use gunicorn manage:app --keyfile ssl_certificate/aaa.key --certfile ssl_certificate/aaa.pem on my heroku server. Heroku has its own https service, I don't need to do anything to make it work. So when accessing example.herokuapp.com, it will cause error. 3. Actually, when accessing my project with my.com, it also causes error and I haven't figured out why. 4. On Heroku website https://devcenter.heroku.com/articles/ssl-endpoint, there's such a sentense: To enable SSL on a custom domain, for example, www.example.com, use the SSL Endpoint add-on. SSL Endpoint is a paid add-on service. Please keep this in mind when provisioning the service. Does that mean I have to use Heroku add-on (20$ a month, a lot for a student) to enable Https on my.com? Is it possible to make it happen with flask? 5. I don't know if this mail should also be sent to the mailist, will it confuse the others? Lu ________________________________ ???: Ares Ou ????: 2016?10?20? 0:39:06 ???: ? ?? ??: flask at python.org ??: Re: [Flask] Question about SSL certificate on custom domain Hi, I guess you should check out how to implement HTTPS on the web server. For example, Apache or Nginx. Of course the dev server in Flask also supports SSL if you set it up correctly. I did a brief search and found this snippet which might be helpful to you: http://flask.pocoo.org/snippets/111/ . Let me know if you have any question following this article. Thanks. Best regards, Ares Ou Software Engineer / Full-Stack Python Developer Blog: http://aresou.net | Github: https://github.com/aresowj Stack Overflow: http://stackoverflow.com/users/5183727/ares-ou Ares Ou On Wed, Oct 19, 2016 at 9:35 AM, ? ?? > wrote: Hello Everyone: I'm a beginner to web development. I followed Miguel Grinberg's book and develop the flasky blog system. I deployed it to Heroku. Now I bought a new domain name and resoluted the domain to my Heroku domain. When using the new domain, I found that it can't pass the SSL certification when using https. (Of course, the original Heroku URL is https enabled.) There's always a red cross on the URL in my Chrome browser. I bought a free CA from Symantec and got two files .key and .pem.. Can anybody tell me how to use these two files in my FLASK project and make the https function well? And one more question. When I run my project with http using my own domain name, the user login state can't last long. I frequently need to login again. When I run it in https in Heroku domain name, it works well. Is that because the browser refresh the cookies under unsafe http browsing? Before reading this book, I have barely no idea about web, HTTP, maybe the question is a little bit silly. I hope someone could help me. Thanks a lot! Lu 2016.10.19 _______________________________________________ Flask mailing list Flask at python.org https://mail.python.org/mailman/listinfo/flask -------------- next part -------------- An HTML attachment was scrubbed... URL: From coreybrett at gmail.com Wed Oct 19 13:12:48 2016 From: coreybrett at gmail.com (Corey Boyle) Date: Wed, 19 Oct 2016 13:12:48 -0400 Subject: [Flask] Question about SSL certificate on custom domain In-Reply-To: References: Message-ID: @luseiee - When using Heroku, your application will be behind their proxy service. Therefore, you need to install the certs within their system. https://devcenter.heroku.com/articles/ssl On Wed, Oct 19, 2016 at 12:39 PM, Ares Ou wrote: > Hi, > > I guess you should check out how to implement HTTPS on the web server. > For example, Apache or Nginx. Of course the dev server in Flask also > supports > SSL if you set it up correctly. I did a brief search and found this snippet > which > might be helpful to you: http://flask.pocoo.org/snippets/111/ . Let me know > if you > have any question following this article. > > Thanks. > > > > Best regards, > Ares Ou > > Software Engineer / Full-Stack Python Developer > > Blog: http://aresou.net | Github: https://github.com/aresowj > Stack Overflow: http://stackoverflow.com/users/5183727/ares-ou > > Ares Ou > > On Wed, Oct 19, 2016 at 9:35 AM, ? ?? wrote: >> >> Hello Everyone: >> >> >> I'm a beginner to web development. >> >> >> I followed Miguel Grinberg's book and develop the flasky blog system. I >> deployed it to Heroku. >> >> >> Now I bought a new domain name and resoluted the domain to my Heroku >> domain. When using the new domain, I found that it can't pass the SSL >> certification when using https. (Of course, the original Heroku URL is https >> enabled.) There's always a red cross on the URL in my Chrome browser. >> >> >> I bought a free CA from Symantec and got two files .key and .pem.. Can >> anybody tell me how to use these two files in my FLASK project and make the >> https function well? >> >> >> And one more question. When I run my project with http using my own domain >> name, the user login state can't last long. I frequently need to login >> again. When I run it in https in Heroku domain name, it works well. Is that >> because the browser refresh the cookies under unsafe http browsing? >> >> >> Before reading this book, I have barely no idea about web, HTTP, maybe the >> question is a little bit silly. >> >> >> I hope someone could help me. >> >> >> Thanks a lot! >> >> >> Lu >> >> 2016.10.19 >> >> >> >> >> _______________________________________________ >> Flask mailing list >> Flask at python.org >> https://mail.python.org/mailman/listinfo/flask >> > > > _______________________________________________ > Flask mailing list > Flask at python.org > https://mail.python.org/mailman/listinfo/flask > From luseiee at outlook.com Wed Oct 19 13:22:03 2016 From: luseiee at outlook.com (=?gb2312?B?wr0g0OyzrA==?=) Date: Wed, 19 Oct 2016 17:22:03 +0000 Subject: [Flask] =?gb2312?b?tPC4tDogIFF1ZXN0aW9uIGFib3V0IFNTTCBjZXJ0aWZp?= =?gb2312?b?Y2F0ZSBvbiBjdXN0b20gZG9tYWlu?= In-Reply-To: References: , Message-ID: Dear Corey Boyle: Thanks a lot!! I will follow the instruction of Heroku. I hope this problem can be solved. Lu ________________________________ ???: Corey Boyle ????: 2016?10?20? 1:12:48 ???: Ares Ou ??: ? ??; flask at python.org ??: Re: [Flask] Question about SSL certificate on custom domain @luseiee - When using Heroku, your application will be behind their proxy service. Therefore, you need to install the certs within their system. https://devcenter.heroku.com/articles/ssl On Wed, Oct 19, 2016 at 12:39 PM, Ares Ou wrote: > Hi, > > I guess you should check out how to implement HTTPS on the web server. > For example, Apache or Nginx. Of course the dev server in Flask also > supports > SSL if you set it up correctly. I did a brief search and found this snippet > which > might be helpful to you: http://flask.pocoo.org/snippets/111/ . Let me know > if you > have any question following this article. > > Thanks. > > > > Best regards, > Ares Ou > > Software Engineer / Full-Stack Python Developer > > Blog: http://aresou.net | Github: https://github.com/aresowj > Stack Overflow: http://stackoverflow.com/users/5183727/ares-ou > > Ares Ou > > On Wed, Oct 19, 2016 at 9:35 AM, ? ?? wrote: >> >> Hello Everyone: >> >> >> I'm a beginner to web development. >> >> >> I followed Miguel Grinberg's book and develop the flasky blog system. I >> deployed it to Heroku. >> >> >> Now I bought a new domain name and resoluted the domain to my Heroku >> domain. When using the new domain, I found that it can't pass the SSL >> certification when using https. (Of course, the original Heroku URL is https >> enabled.) There's always a red cross on the URL in my Chrome browser. >> >> >> I bought a free CA from Symantec and got two files .key and .pem.. Can >> anybody tell me how to use these two files in my FLASK project and make the >> https function well? >> >> >> And one more question. When I run my project with http using my own domain >> name, the user login state can't last long. I frequently need to login >> again. When I run it in https in Heroku domain name, it works well. Is that >> because the browser refresh the cookies under unsafe http browsing? >> >> >> Before reading this book, I have barely no idea about web, HTTP, maybe the >> question is a little bit silly. >> >> >> I hope someone could help me. >> >> >> Thanks a lot! >> >> >> Lu >> >> 2016.10.19 >> >> >> >> >> _______________________________________________ >> Flask mailing list >> Flask at python.org >> https://mail.python.org/mailman/listinfo/flask >> > > > _______________________________________________ > Flask mailing list > Flask at python.org > https://mail.python.org/mailman/listinfo/flask > -------------- next part -------------- An HTML attachment was scrubbed... URL: