I have two files for my PWA, service-worker.js and manifest.json, but i not know or to put in the django project, at the root of project ?
There is no tutorial that explains well for Django...
This is content of service-worker.js :
https://paste.ee/p/c5Fme
This is content of manifest.json :
https://paste.ee/p/LKxOa
And in the template base.html : https://paste.ee/p/bj5wz
In terms of content, everything is ok?
so.. i need help for the place of files. Thanks guys
Put it inside of app templates folder, Ex: yourapp/templates
Related
I am quite new to django so I am sorry if I have overlooked something simple.
This is my current website: https://www.michealnestor.com
I am trying to remake it using react and django, and a lot of it is different, however I want to keep the functionality of being able to run my js apps from the website: https://www.michealnestor.com/projects EXAMPLE: https://www.michealnestor.com/projects/sortingalgorithms/ .
I want to be able to upload project folders, with html, css and js in them from the admin page, and then be able to open these projects from my website. I am not sure how to do this though.
I have tried manually placing such a folder in a templates folder in my app, and I have managed to use a view to load the html file, but this file can't seem to find the css and js.
Maybe I am going about this the wrong way, in any case I would appreciate some guidance!
I've got a Marzipano sample with all the necessary files and folders. When I open index.html a 360 viewer runs in the browser and everything works fine.
Now I want to get the same thing working inside of Django project.
The directory structure for Marzipano sample looks this:
vendor/
tiles/
img/
data.js
index.html
index.js
styles.css
The only folder I care is tiles, which has many folders with images.
To get this working in Django I have to put those images in the right place in the static folder of Django project.
I tried to figure out where exactly inside of JavaScript files the image paths are set, but unfortunately I have very poor knowledge of JavaScript.
I would be grateful for any advice.
If anyone ever comes across this problem, one way to solve it is through web server configuration. I am working with nginx and I could open a 360 viewer at desired URL by using 'location' directive:
location /gallery-360/ {
root home/user/project;
}
This way there is no need to deal with Django urls, views and static files issues.
I would like to know how should i could manage to change the static files use by the saelor framework. I've tried to change the logo.svg but failed to do so.
I'm still learning python program while using the saleor framework for e-commerce.
Thank you.
Here is how it should be done. You must put your logo in the saleor/static/images folder then change it in base.html file in footer and navbar section.
I am trying to use any of these page templates located here Zurb
Some of the template (navbar), but not the content. Basically when I try to navigate to some content nothing happens. I have added the route info to no avail, i.e. -
name: home
url: /
When I create the basic starter project from here: Zurb, the project comes with .scss and a templates.js file, however the page templates just have a .css file.
I've looked through the documentation but haven't found anything showing how to use the page templates. Do I need to creata a .scss file and template.js file on my own and if so how?
For use this templates you must follow this former instruction http://foundation.zurb.com/apps/getting-started.html
For short:
install foundation nodejs module
create app – insert your
put template to client folder
I currently have Django set up to upload files to:
/path/to/project/uploads
This works great. This folder is in the root folder of the project so the files cannot be served directly from a web URL, which is what I want, the files are "CVs" uploaded by users.
I've had a look at a third-party django app called filetransfers which would do the job, but I'm wondering if there is a way with Django core to serve files from outside the media folder.
Any help would be great.
Andy
Depending on what web server you are using I would recommend using X-sendfile if you use Apache or X-accel-redirect if you use Nginx. But remember you will need to change setting in your web server. But this is far more efficient way of serving files than using Django to do it.
If what you want is to keep control on how your files are served / who can see them etc, then the simplest solution is to write a custom view serving theses files. You just have to provide the file's content as the response body and set the appropriate response headers (file type, content length etc). Reading the FineManual(tm) part about the Response object should be a good starting point.
Resolved using FileWrapper().
Thanks anyway.