while changing static content from one website into dynamic i am getting server error ,i am loading stuff from tutorial which i am following properly but still checking thrice i am not able to solve problem.

Syed Ali Hussnain Gillani 1 Reputation point
2022-07-10T07:06:49.727+00:00

I am working on Django using visual studio code and making a static website dynamic but when am trying to run the server it is giving me error this happens when I try to change index stuff and loading it from static folder in jinja format otherwise page is showing normally without pictures and editing that I have done ,I am beginner in this stuff and not able to catch the problem from root I am attaching screenshots so maybe you can catch it and help me to solve this issue.
219168-capture1.png
219228-capture2.png
219216-capture5.png
219217-capture2b.png
219198-capture3.png
219209-capture4.png

Windows Server
Windows Server
A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.
13,661 questions
Azure Static Web Apps
Azure Static Web Apps
An Azure service that provides streamlined full-stack web app development.
1,067 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Ryan Hill 29,651 Reputation points Microsoft Employee
    2022-07-10T20:15:53.733+00:00

    Try loading staticfiles instead of static. I think this is tied to INSTALLED_APPS on your leo5.settings module. Also, it could be a moot point but try adding a space in between static and the link to your static file content.

    219220-image.png
    219322-image.png

    ---
    EDIT: 2022 July 12 I've got an update @Syed Ali Hussnain Gillani . I was moving some static content around as well and ran into a similar problem where content wasn't being loaded correctly. I however hit an staticfiles.E002 which led me to this stackoverflow answer and was able to resolve it with the following in my settings.py:

       # Static files (CSS, JavaScript, Images)  
       # https://docs.djangoproject.com/en/2.1/howto/static-files/  
       STATICFILES_FINDERS = [  
           'django.contrib.staticfiles.finders.FileSystemFinder',  
           'django.contrib.staticfiles.finders.AppDirectoriesFinder',  
       ]  
         
       STATICFILES_DIRS = [  
           os.path.join(BASE_DIR, 'static'),  
       ]  
         
       #STATIC_ROOT = posixpath.join(*(BASE_DIR.split(os.path.sep) + ['static']))  
       STATIC_URL = '/static/'  
    

    where BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

    219937-image.png

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.