tutorialdb icon indicating copy to clipboard operation
tutorialdb copied to clipboard

Static Files Bug when running 'manage.py test' for setup

Open hstandeffer opened this issue 6 years ago • 6 comments

Describe the bug The bug appears after going through the setup; the program is unable to locate the static files root directory. I have tried running python manage.py collectstatic while changing the static file paths which resolves most errors, but still leaves me with a final 404 error:

`FAIL: test_tutorials_page_status_code (api.tests.test_views.APITests)

Traceback (most recent call last): File "C:\Users\temp\hacktoberfest\tutorialdb\api\tests\test_views.py", line 8, in test_tutorials_page_status_code self.assertEquals(response.status_code, 200) AssertionError: 404 != 200`

To Reproduce Steps to reproduce the behavior:

  1. Go through the initial setup steps of creating venv and installing requirements
  2. After running the migrate command, run the test command from setup
  3. See error

Expected behavior Status code of 200, asserting page was created correctly

hstandeffer avatar Oct 09 '19 17:10 hstandeffer

#43 may be a possible fix.

I tried it out, but the error that is coming now is ValueError: Missing staticfiles manifest entry for 'app/tutorialdb.png'.

Animesh-Ghosh avatar Oct 09 '19 17:10 Animesh-Ghosh

I've continued trying to resolve this issue, but am having no luck. Are there any updates on getting this to correctly load the database?

hstandeffer avatar Oct 15 '19 19:10 hstandeffer

Did you see my comments in #9?

You need to specify a .env file. Have you worked with .env files before?

Animesh-Ghosh avatar Oct 16 '19 03:10 Animesh-Ghosh

`FAIL: test_tutorials_page_status_code (api.tests.test_views.APITests)

this test will fail due to reasons I am still not able to understand. you can ignore this message.

Bhupesh-V avatar Oct 18 '19 07:10 Bhupesh-V

Firstly i change {% load staticfiles %} to {% load static %} static file issue resolve and then the 404 error because api url not found so i added the /api/tutorials/ then it work find i hope this will help to fix your issue

Aashish095 avatar Oct 01 '23 13:10 Aashish095