On Fri, Oct 13, 2017 at 1:09 AM, Ben Bacarisse <ben.use...@bsb.me.uk> wrote:
> Chris Angelico <ros...@gmail.com> writes:
>
>> On Thu, Oct 12, 2017 at 7:32 PM, Thomas Jollans <t...@tjol.eu> wrote:
>>> On 2017-10-12 07:31, Chris Angelico wrote:
>>>> On Thu, Oct 12, 2017 at 12:19 PM, Ben Bacarisse <ben.use...@bsb.me.uk> 
>>>> wrote:
>>>>> Provided some early part of the URL is handled by PHP, the rest of the
>>>>> URL path is provided to PHP in $_SERVER["PATH_INFO"].
>>>>
>>>> Is it possible to do that without having ".php" visible in the path?
>>>
>>> Just like with Python-based frameworks, this requires a few lines of web
>>> server configuration.
>>>
>>> On Apache, you might use mod_wsgi to tell the server how to run the code
>>> in one case, and a combination of mod_php and mod_rewrite in the other.
>>> If you're using FastCGI with nginx or lighttpd, I believe the
>>> configuration would look pretty similar in both cases.
>>>
>>> Then again, I don't do much web programming any more and generally stay
>>> away from PHP, so I may be misremembering.
>>
>> Normally, with a Python-based framework, you don't need _any_ web
>> server configuration. You simply define your URL routing within the
>> Python code. The only thing the web server needs to know is where to
>> find the web app, and that's sufficiently standard that it can be done
>> off-the-shelf; for instance, you push your code to Heroku, and they
>> set everything up to pass requests to your app. Not possible with PHP,
>> since you need *custom* web server config to manage your rewrite
>> rules.
>
> That's at odds with what I've read online which admittedly may be all
> junk.  I wanted to try Flask so I installed the Ubuntu packages but then
> got stuck on a huge document that suggested I needed to install things
> called Nginx and Gunicorn.  You've now mentioned another: Heroku.  I'm
> sure the complex instructions I found are not really required -- it was
> probably just the usual "this is what I did so this is how it's done"
> document, but I'm having trouble finding the simpler way to do it.
>
> Since no web server configuration is needed (I have a working Apache
> installation that mirrors, as closely as possible, what my hosting
> provider uses) it should be relatively easy.  Can you tell me, or can
> you point me to a resource that tells me, where to put the app?  I don't
> yet know what "push your code to Heroku" means.

I abbreviated that down to nothing, but since you ask, here's a really
REALLY simple run-down of how to use Heroku:

1) Create a git repository to manage your code. (You should be doing
this anyway.)
2) Install the Heroku CLI for your platform
3) Run "heroku login" and enter your credentials (once)
4) Run "heroku create" from your project repo to generate a URL to use
for the project
5) Ensure that you list all your requirements in a file called
"requirements.txt". Heroku uses this to (a) recognize that it's a
Python project, and (b) install your dependencies, with "pip install
-r requirements.txt".
6) Tell Heroku how to find your main file by making a file called "Procfile"
7) Run: "git push heroku master"

There are other ways to do things (notably, Heroku will work with
GitHub and Travis to do CI/CD just by pushing code to the master
branch on GitHub - Travis will run your tests and then push to Heroku
for you), but this is about the simplest it gets. Yes, there are a
good few steps there, but most of them are simple one-offs, or are
things you should do anyway.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to