Forums

how to setup development environment

Hello,

Currently, I am updating my site by directly modifying the production files. I would like to setup a development environment, so that I can modify files in the development environment without impacting the production environment. Then, when I'm ready to update production, I can then upload the development environment files to replace the production files.

  • Should I setup the development environment on my laptop?
  • Is github a good way to transfer the files from my laptop to PythonAnywhere?
  • When I transfer the files to PythonAnywhere, does it just replace the old files?
  • Do I need to do anything more to have the production environment work smoothly after updating files - like any commands for updating databases?

Thank you!

Answering your questions one-by-one:

Should I setup the development environment on my laptop?

Yes, that's a good option.

Is github a good way to transfer the files from my laptop to PythonAnywhere?

Yes, it's an excellent choice for that.

When I transfer the files to PythonAnywhere, does it just replace the old files?

If you use git push to transfer your changes from your laptop to GitHub, and then git pull to get them on to PythonAnywhere, then yes, that's what will happen.

Do I need to do anything more to have the production environment work smoothly after updating files - like any commands for updating databases?

Yes, you'll need to set up database migrations. Those are built into Django (and there are many good tutorials on how to use them) and other frameworks also have support for them, either built-in or via an add-on module. If you google for the name of your web framework plus "database migrations" you'll find the appropriate things.

Oh, I should also add that your site will probably have certain settings different for your dev environment and the production one. For example, in Django you might have different values that you want in settings.py in dev vs production. Other web frameworks will be similar.

There are good standard ways to handle that kind of thing -- again, the name of your framework plus "dev vs production settings" is a good way to track down the details of what you need for your site.

Excellent, thank you!