Failed to reset admin password (missing .env)

Priority: Urgent
Project Link:

Admin password cannot be reset because of the following error:
Reset password for superuser failed. Error: /usr/local/lib/python3.6/dist-packages/environ/ UserWarning: /opt/webapp/my_app_18674/.env doesn’t exist - if you’re not configuring your environment separately, create one.
“environment separately, create one.” % env_file)

Developer said that in case if this file is missing than whole application should fail, which is not. So it seems to be problem with that “Reset Password” functionality. Initial “Create” password action also failed with some error (not present in log for some reason).
I also tried to re-deploy app, but it did not fix the problem.

@dmitrii.k any ideas?

@sgmagar When you’re online, could you please look into this?

@daniil.zubach in the settings file of this project, it’s reading from the .env file with this line environ.Env.read_env(). Since, it doesn’t exist in server, it’s giving the warning and because of this reset password functionality is failing. Once you remove this line, it will work fine. For local, we are loading env var via docker-compose so, we don’t need this line in local as well, so we can just remove this.