Code4PuertoRico / una-hora

MIT License
9 stars 2 forks source link

OperationalError (Exception error) #23

Closed Hectoronian closed 2 years ago

Hectoronian commented 2 years ago

Greetings Team!

My environment:

Currently I'm trying to follow the steps to be able to run the una-hora by following the 2nd steps (localized use), but I got stuck on the following step:

Once this step starts, it triggers an OperationalError at the end (attached the traceback):

django.db.utils.OperationalError: could not translate host name "database" to address: Name or service not known

OperationalError.log

I've managed to edit the .env variables and used:

DATABASE_HOST=localhost instead of DATABASE_HOST=database

And now I get the following:

FATAL: password authentication failed for user "postgres"

Now, to get passed that authentication failure, I was able to change the default postgres password (Linux Parrot OS Debian):

sudo -u postgres psql

\password Input Password: password Input again: password quit

After that, everything runs smoothly, except that it doesn't load the .css files:

WARNING 2021-12-16 00:10:24,248 log 667502 139982161573632 Not Found: /static/css/dist/styles.css [16/Dec/2021 00:10:24] "GET /static/css/dist/styles.css HTTP/1.1" 404 13027

No CSS

github-actions[bot] commented 2 years ago

Gracias por por tu aportación! El equipo le dara un vistazo pronto.

rnegron commented 2 years ago

It seems like you are running the project locally instead of using Docker (instructions for using Docker here: https://github.com/Code4PuertoRico/una-hora/blob/main/docs/en/README-devs.md#option-1-docker)

In that case, you'll need to run these two commands so that the frontend dependencies are installed and loaded:

$ pipenv run python manage.py tailwind build
$ pipenv run python manage.py collectstatic --no-input

I updated the READMEs to include these two commands: https://github.com/Code4PuertoRico/una-hora/blob/main/docs/en/README-devs.md#option-2-local

Let me know if it works 👍🏻

Hectoronian commented 2 years ago

Thank you @rnegron 😄 💯 this worked perfectly, even on Windows 10. In the case of Windows 10 I did some changes to make it work:

I currently have NodeJs 17+ and whenever I ran this step:

pipenv run python manage.py tailwind install

This message appeared:

It looks like node.js and/or npm is not installed or cannot be found. Visit https://nodejs.org to download and install node.js for your system. If you have npm installed and still getting this error message, set NPM_BIN_PATH variable in settings.py to match path of NPM executable in your system. Example: NPM_BIN_PATH = "/usr/local/bin/npm"

I was able to mitigate this by adding the NPM_BIN_PATH = r"C:\Program Files\nodejs\npm.cmd" to the settings.py file, in this case:

File: local.py Location: (DRIVE) --> \config\settings\local.py

Source: Installation Django Tailwinds issues

I had issues trying out the Docker container using Docker Desktop (Win10) but I'll double-check I'm doing everything right, if not, I'll hit you up in an issue request.

This issue is now solved