Switching to production mode breaks Erpnext (404 errors)

I’m facing the exact issue for about two weeks!
The page seems loaded without CSS on port 80 after sudo bench production frappe command!
Someone help us here PLEASE!
I’m on version 13.32.0

By the way, you have the error 404 because supervisor is not working, try to start the services for both (nginx & supervisor)

sudo service nginx start
sudo service supervisor start

But unfortunately, that will not solve the CSS issue!

Like I mentioned earlier in the thread, the missing css is likely a permissions issue. Check your nginx logs.

Thank you @peterg
In fact, I’m not a developer, so I struggle a lot when you just mention a “permissions issue”, I don’t know how to fix it nor how to check it!

I found the following answer which seems have solved the problem with CSS:

but a new error arised:

after copying the error, here is the result:

### App Versions

	"frappe": "13.32.0"

### Route


### Trackeback

Traceback (most recent call last):
  File "apps/frappe/frappe/app.py", line 69, in application
    response = frappe.api.handle()
  File "apps/frappe/frappe/api.py", line 55, in handle
    return frappe.handler.handle()
  File "apps/frappe/frappe/handler.py", line 38, in handle
    data = execute_cmd(cmd)
  File "apps/frappe/frappe/handler.py", line 76, in execute_cmd
    return frappe.call(method, **frappe.form_dict)
  File "apps/frappe/frappe/__init__.py", line 1448, in call
    return fn(*args, **newargs)
  File "apps/frappe/frappe/desk/page/setup_wizard/setup_wizard.py", line 282, in load_messages
    m = get_dict("page", "setup-wizard")
  File "apps/frappe/frappe/translate.py", line 207, in get_dict
    message_dict = make_dict_from_messages(messages, load_user_translation=False)
  File "apps/frappe/frappe/translate.py", line 243, in make_dict_from_messages
    full_dict = load_lang(frappe.local.lang)
  File "apps/frappe/frappe/translate.py", line 302, in load_lang
    path = os.path.join(frappe.get_pymodule_path(app), "translations", lang + ".csv")
TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'

### Request Data

	"type": "POST",
	"args": {
		"language": "English"
	"freeze": true,
	"headers": {},
	"error_handlers": {},
	"url": "/api/method/frappe.desk.page.setup_wizard.setup_wizard.load_messages"

### Response Data

	"exception": "TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'"

Moreover, I noticed the following log when executing cat ~/frappe-bench/logs/web.error.log is that normal?

I finally give up and dropped my site to create a new site and it is working well

Can you explain how to fix the css issue? I am unable to decipher the answer you linked

  • edit /etc/nginx/nginx.conf and add into the http { section: disable_symlinks off;
  • remove both symlinks and use bind in /etc/fstab, for example:
    /opt/erpnext/frappe-bench/apps/erpnext/erpnext/public /opt/erpnext/frappe-bench/sites/assets/erpnext none defaults,bind 0 0

What does “removing symlinks” and “use bind” even mean? I looked for both the terms inside nginx.conf and I couldn’t find them (could you please link them). Also there was no folder named “fstab” in /etc/fstab.

I didn’t do that part, I just changed the user that nginx use by commenting the first line and adding another one with my frappe user. Moreover, I added the disable_symlinks off; under http {} section. Then restarted the nginx service and it’s just work!
Later on, I found a command which seems to do the last part of fstab thing which I didn’t do because I didn’t understand it very well, and here it is:

bench build --hard-link

and here is a screenshot of my nginx.conf file:

1 Like

only need to change /etc/nginx/nginx.conf with above changes and its good to go!