horilla-opensource / horilla

Horilla is a free and open source HR software.
https://www.horilla.com/
GNU Lesser General Public License v2.1
191 stars 133 forks source link

images issue #374

Open smolisso opened 3 days ago

smolisso commented 3 days ago

Bug Report

Description

When I try to load an image for an Employee the message says that is correct uoloaded, but I can't see the image icon.

image

I've checked inside the container and I've found the image I've uploaded is in the path: /app/media/employee/profile

If I try to open the direct link to the image: https://myhorilla.test.example.local/media/employee/profile/stefano_qHXzRie.jpeg

I receive a 404 error page. image

Is it my fault? What I'm wrong?

Thx

[A brief description of the bug or issue you're encountering.]

Steps to Reproduce

  1. [Detailed step-by-step instructions to reproduce the issue.]

Expected Behavior

[What you expected to happen.]

Actual Behavior

[What actually happened.]

Screenshots

[If applicable, provide screenshots illustrating the issue.]

Environment

Additional Information

[Any other relevant information, logs, error messages, or context that might help in understanding and fixing the issue.]

Possible Solution

[If you have any ideas or suggestions on how to fix the issue, feel free to provide them here. This is optional.]

Labels

[If your project uses labels, suggest any labels that might apply to this issue, such as 'bug', 'needs investigation', etc.]

Priority

[Specify the priority level for this issue, such as 'high', 'medium', 'low', etc.]

Assignees

[If you want to suggest an assignee or tag a specific person to look into this issue, mention their GitHub username here.]

Related Issues

[If there are any related issues or pull requests, mention them here. This is optional.]

Note: Remember to search through existing issues before submitting a new one to ensure that the issue hasn't been reported already. Provide as much information as possible to help the maintainers understand and address the problem effectively.

horilla-opensource commented 2 days ago

Hi @smolisso , Can we know the method you have used to host the system?

smolisso commented 2 days ago

Hi @smolisso , Can we know the method you have used to host the system?

Hello, it's a Debian 12 machine with Docker CE

root@test-horilla:~# docker --version
Docker version 27.3.1, build ce12230
root@test-horilla:~/horilla-1.2.1# docker ps
CONTAINER ID   IMAGE                  COMMAND                  CREATED        STATUS                  PORTS                                       NAMES
dae73f48c339   horilla-121-server     "./entrypoint.sh"        22 hours ago   Up 22 hours             0.0.0.0:8000->8000/tcp, :::8000->8000/tcp   horilla-121-server-1
4dbb9e3e96aa   postgres:16-bullseye   "docker-entrypoint.s…"   22 hours ago   Up 22 hours (healthy)   0.0.0.0:5432->5432/tcp, :::5432->5432/tcp   horilla-121-db-1
horilla-opensource commented 1 day ago

Hi @smolisso , Can you confirm the media path inside the settings.py file?

smolisso commented 1 day ago

Hi,

root@test-horilla:~/horilla-1.2.1# cat horilla/settings.py | grep -i media
MEDIA_URL = "/media/"
MEDIA_ROOT = os.path.join(BASE_DIR, "media/")

The very strange thing is that I tried to set the DEBUG variable to True:

# Set "DEBUG=False" for production
DEBUG=True

....and now, it works!

If I set it back to FALSE it doesn't work. Very very strange behaviour.

horilla-opensource commented 1 day ago

Hi @smolisso , Thanks for the clarification. Our team is looking into this and we'll get back to you.

horilla-opensource commented 1 day ago

Hi @smolisso ,

Which web server are you using for the hosting purpose (Apache/ Nginx)?

smolisso commented 23 hours ago

As I told you in previous post, it runs inside your official Docker containers.

horilla-opensource commented 7 hours ago

For going into production with the Docker image file, you need to change the MEDIAROOT value inside the settings.py to '/app/media/_' and also serve a web server for the same.

MEDIA_URL = '/media/'
MEDIA_ROOT = '/app/media/'  

Restart the container and try again.