0

I have a django application and trying to load the front end from by django project. My index.html is:

<link rel="icon" type="image/x-icon" href="favicon.ico">
  {% load static %}
<link rel="stylesheet" href="{% static "styles.38614f36c93ac671679e.css" %}"></head>
<body>
<app-root></app-root>
{% load static %}
<script type="text/javascript" src="{% static "runtime.a66f828dca56eeb90e02.js" %}"></script><script type="text/javascript" src="{% static "polyfills.f3fc5ca24d1323624670.js" %}"></script><script type="text/javascript" src="{% static "scripts.5bde77e84291ce59c080.js" %}"></script><script type="text/javascript" src="{% static "main.e7b9143f2f482d6d3cc7.js" %}"></script></body>
</html>

and in settings.py of project file i have added static file settings:

STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'static')

my project structure is:

apt.yml     DCMS_API/  infra/  manage.py*    odbc-cfg/  requirements.txt  static/       templates/
Authorize/  facility/  manifest.yml  Procfile   runtime.txt

when i uploaded the code on cloud foundry and tried to run the application it says

ERR Not Found: /static/runtime.a66f828dca56eeb90e02.js
ERR Not Found: /static/styles.38614f36c93ac671679e.css
ERR Not Found: /static/polyfills.f3fc5ca24d1323624670.js
ERR Not Found: /static/scripts.5bde77e84291ce59c080.js
ERR Not Found: /static/main.e7b9143f2f482d6d3cc7.js

What am i missing?

2
  • 1
    Is BASE_DIR set correctly? It almost looks like it's trying to find the file at /static which won't exist on CF. Your files will be under /home/vcap/app/static or /app/static (/app is a symlink to the former location). Maybe try the hardcoded path and see if that helps? Commented Nov 18, 2019 at 20:07
  • It worked after adding static_dir where we mention static folder but it load only home page when i try to load other pages from ui it says that file not found Commented Nov 19, 2019 at 18:55

1 Answer 1

0

did you run python manage.py collectstatic ?

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.