How does everyone else create a Website?

Setup: Frappe v15 with a single custom app, installed on a single site on a development environment.

I’ve spent many days trying various methods of creating a website. In conclusion I’m not sure which is the most appropriate method. So I’d like to know how does everyone else do it?

Here are some of the considerations / caveats:

1 Web Templates can be defined as Standard : Y, which means they are persisted to the app’s File System (FS), and hence built-in on the custom app, and will install on a production environment.

2 Web Pages are by default persisted in the dev site’s database (DB) and hence is not a built-in feature of the app. In order to deploy / install these to production you have to export them as fixtures.

3 Website Settings are likewise persisted to the site’s DB and has to be exported as a fixture in order to install / deploy it. However, unlike Web Pages, Website Settings is a Single DocType. Hence you cannot develop multiple websites on a dev environment.

4 There are many other caveats with regard to Website Theme and the so called Standard Pages (viz Login, About Us, Contact Us, Blog, etc)

So, how do you DEVELOP a website on a dev environment and then deploy it onto a production server?
As far as I can see there is no way of doing this other than developing it on the production environment
directly.

Hello Eugene,
the general workflow is to setup a git repository for your custom app. When you create new objects like Web Pages choose your custom app as “Module”. E.g. our app is named “erpituc”:


This will persist your new object to the file system. You can then push your changes to the git repository.

When you do “bench update” on your production server your changes get checked out and are activated. This is the easiest way, the only challenge is to setup your custom app in a git repo and adding it from there to your bench.

If you dont like git repo, you can zip your custom app in your development stage, unzip it on your production environment and run:
bench migrate
bench restart --supervisor

I like the git based deployment better.

1 Like

Hello @thkr_ituc

Thanks for the detailed response.

With regard to all the references to git and GitHub, that is standard procedure, and part of our development workflow anyhow.

With regard to the Module definition on the Web Page form, that I’m afraid does not persist the definition on the app’s FS. It is only used to determine the module’s directory in the event of you exporting it as a fixture.

My dilemma is : With so many different ways of persisting the various “components” of a website, and each requiring a different method of getting it into production, which is the most appropriate way of developing a website? Not to mention that you cannot have multiple “versions” of Website Settings, other than developing on multiple dev sites to accommodate the Single DocType nature of Website Settings.

In my opinion, a website should not really be defined in a custom app, since a site can have multiple apps deployed onto it. Hence a website is more a feature of the site than of any specific app. However you cannot develop a site and deploy it as you can develop / deploy an app. Hence the most appropriate method of developing a website is to do so on the prod environment directly. But maybe I’m missing something, and that is why I’m posing this question.

Sorry, my bad. You are right, setting the Module does not persist the web page. We are using Web Pages for a Help System, and I just learned that these are edited directly on our production system.

1 Like

@EugeneP

All of your considerations and canveats are going on the right direction!

We developed some websites past year, all those using Frappe and ERPNext

www.techmaxsolucoes.com.br
exito.tmx.tec.br
berio-topo.com

In our process to deploy to production we are exporting a lot of things as fixtures

Also, we created an method to export fixtures and move the attachments to the app/public/images folder

Also this method ensure that all links on the exported fixtures are moved from /files/ to /assets/app/img

We also created a custom app, that preserve our we templates that are shared across all the projects we do!

There no shortcut to make great websites with Frappe and ERPNext.

It’s a journey that requires learning from the ground, and on every new website you do, you will master that process!

For us, it took 2 years to become fully productive with that, and we are producing about 1 website per week!

2 Likes

Thanks so much @max_morais_dmm

Which of these 2 approaches would you recommend:

1 Developing on a dev environment, involving the convoluted methods of built-in Web Templates, exporting Web Pages, Files, Themes, Website Settings, etc, as fixtures, making sure the Attachments are transferred and referenced correctly, etc
2 Simply bypass all that headache and develop the website in-situ on the production environment

Thanks for the links :+1:

1 Like

@EugeneP development environment is always the right way!

More than one time, we did changes that broke up the things in a way that the fast way, was to discard everything and start fresh!

That’s why I always will recommend the development way!

It’s more painful, need to work to work the right way, but save you, from catastrophes!

2 Likes

Okay, I understand the need to be able to develop the website separately from the “version” in production.

However, do you have a completely separate development environment for each website / version under development ? In other words individual sites, all managed by the same bench. This seems to be the only way of getting around the limitation of Website Settings being a Single DocType.

1 Like

@EugeneP yes that’s how we did

1 Like

Further to developing a website on a dev environment and then deploying it onto a production server, how does everyone transfer icon / image files from dev to production?

Currently I’m defining the icon / image files on the various Website Settings / Web Page GUI forms which brings up the modal to upload an image. This modal is identical to when Attach a file, and you have the option of specifying the file to be either Public or Private. I specify all icon / image files to be Public, resulting in them rendering for all visitors of the page not only logged-on users with access rights to the file. The consequence of this is that the files are placed in the …/sites/[sitename]/public/files/ directory. The caveat is, not all uploaded files are also Attachments and hence persisted in tabFiles on the database.

So, how do I bundle the icon / image files as built-in on the custom app, so that when I deploy it the images are also deployed to the correct …/sites/[sitename]/public/files/ directory?

Thanks so much.