I am trying to package a django application which also contains script files(angularJS). When I create an exe , its not able to load the static files(404 error). I tried python manage.py collectstatic and its copying the files from the correct location. But when I run the exe, its not able to load the files.
Theres a related question,but that solution didnt solve the problem.Location of static files when creating a Django exe using pyinstaller
My settings.py file
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
STATIC_URL = '/res/'
STATIC_ROOT = os.path.join(BASE_DIR, "res")
STATICFILES_DIRS = (
os.path.join(BASE_DIR, 'Rule/res'),
)
My spec file:
added_files = [
('Rule\\templates\\*.html','Rule\\templates'),
('Rule\\migrations','Rule\\migrations'),
('Rule\\res\\scripts\\*.js','Rule\\res\\scripts'),
]
Its able to load the templates, but not the script files.
I am loading the script files in my html file like this:
{% block js %}
<script src='{% static "scripts/app.js" %}' ></script>
<script src='{% static "scripts/angular.js" %}'></script>
<script src='{% static "scripts/angular-ui-router.js" %}'></script>
<script src='{% static "scripts/angular-route.min.js" %}'></script>
<script src="{% static "scripts/ui-grid.min.js" %}"></script>
{% endblock %}
Please help me if I am missing something.Thanks