Michael
Michael

Reputation: 1203

Deploy/Reload code from python pyramid project in production

I use ...\pserve development.ini --reload in my dev environment to restart my API when code change.

The doc says:

Auto-template-reload behavior is not recommended for production sites as it slows rendering slightly; it’s usually only desirable during development.

But the doc has no proposition for a production environment. What's the recommendation to reload, do I have to make it manually every time?

Upvotes: 1

Views: 236

Answers (2)

Steve Piercy
Steve Piercy

Reputation: 15055

First of all, you are talking about the section of the documentation, Automatically Reloading Templates. That only discusses how to reload templates automatically, not your entire application.

The documentation explicitly states not to use --reload in production. That is an automatic function, not a manual one.

If you change your code and deploy it to a production environment, it is assumed that you would restart your application manually, thereby removing the need to use --reload when invoking pserve production.ini.

Upvotes: 2

c0lon
c0lon

Reputation: 210

Yes, you will need to restart the service if you change anything in your config file.

If you know that you'll be changing things and don't want to restart it every time that happens, move some of your configs to a database and refactor your app to read from that. This won't be possible for everything, and you'll need to be careful that when an update happens it is applied correctly, but it can be done for some things.

Upvotes: 2

Related Questions