cant download files uploaded tree.io - python

All the files I upload to the tree.io tickets, projects, etc cannot be downloaded,
I am getting a 404 error.
I am running tree.io in a cantos 6 box.
any ideas to get this working please ?

after sometime found a solution for this.
i had to define the MEDIA_ROOT as an absolute URL in the settings.py
when i went to static/media there was no folder called attachments, i had to make one and give it the correct permissions for python can write to that folder.
this worked for me.

Related

static images not served after deployment to heroku

I'm working on a small web application built with python and plotly-dash. Everything worked fine locally and so I deployed the code to Heroku. This also worked fine except for 2 out of 17 static images in the assets folder that won't get served after deployment. The error message is:
Failed to load resource: the server responded with a status of 404 (NOT FOUND)
The initial settings for plotly-dash were set to 'serve assets locally'. So I tried to serve them from an S3 bucket with the same result. These two images can't be found on the server.
One more piece of information. I saw that the file extension for both of these files was '.JPG' instead of '.jpg' for all the other files that are showed correctly. I saved them under XY.jpg but this didn't solve the problem either.
Any ideas what might be the problem here? I honestly run out of ideas. The code can be found here and the website is hosted here Click on 'Analyze' and 'Show me more details' to get to the problematic page.
I appreciate every input. Thanks inadvance.
I finally found the solution. Even though I changed the file extensions from 'JPG' to 'jpg' locally this change didn't make it to GitHub. I ended up converting the files to PNG format, adding and referencing them in the code and they finally showed up after deployment.

Django: unable to locate static files folder

I am trying to setup an AS2 server using the python package django-pyas2 (https://github.com/abhishek-ram/django-pyas2)
Everything has been working fine while I was using the runserver command, but when trying to host my web app using IIS(10), I've noticed that none of my static files get loaded when loading a page.
I've been on countless forums/documentations and I know that I need to setup my IIS to serve these files, but I haven't been able to answer a rather stupid question:
Where is the /static/ folder of django-pyas2 located ???
There is no such folder on the github page.
When using the runserver command, django somehow manages to find all the static files (.css, .js, .png) from the static folder, but I am still totally clueless to where that folder is actually stored.
I've been searching in these locations to no avail: (I'm using a virtual env on Windows Server 2016)
my own project
my venv's site-packages\django-pyas2 folder
in C:\Python37\Lib\site-packages\django-pyas2
in C:\User\AppData\Roaming\Python\Python37\Lib\site-packages\django-pyas2
I've also tried to use the command collectstatic, but I first need to know where the actual /static/ folder is stored.
I've double-checked, and the files are apparently stored locally and not on a CDN. This is driving me kind of nuts, and I could definetly use some help from someone!
A big thanks in advance ❤
EDIT:
my IIS wfastcgi configuration
my IIS advanced settings
I'm not sure about how IIS(10) works but this is usually the fix.
go to settings.py and add a path for your static files.
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'static')#new
Next on the console (command prompt/ terminal/shell) run
python manage.py collectstatic
This should work
OK, so I finally found the static folder I was looking for in this location:
<PYTHON_PATH>\Lib\site-packages\django\contrib\admin\static
I believe the django_pyas2 package is using some default js/css already included with Django, and I couldn't find it because it was burried in Django's files.
For those encountering the same problem, here are the steps I then took to make it work with IIS(10):
copy/pasted the static folder from the django package to my project's root
went to IIS manager, right clicked on my website > Add Application
for the application alias: "static", for the path: <path_to_static_folder>
/!\ IMPORTANT /!\ left clicked on newly created "static" application, went to Mapping Manager, and then deleted the associated FastCGIModule
Didn't have to do anything in settings.py, nor execute the collectstatic command.
Works fine after that!
Thanks for trying to help.

How to fix image is not showing in heroku deployed django app

I have a Blog created with Django 3.x. When I run the project on my local server then it works fine. So, I deployed my project to heroku and here is the link bblog-shovon.herokuapp.com/. Then the project was working fine. My project git link https://git.heroku.com/bblog-shovon.gitThen I created a post and then I gave it a thumbnail and finally everything was fine. But, After sometime when i revisit the site then every image were gone. I didn't found them. And when I tried to open the image on another tab then it shows this Error message screenshot. When I am writing this question then I created a new post and after publishing this this posts image is working. But, older image is not working.
Then, How can i fix this problem? Please help me!!
Heroku flushes the filesystem to the latest commit. So you will have to use third-party plugins such as AWSBucket, etc.
With Heroku the filesystem is not persisted so you will lose media files occasionally. Use S3 or some other provider to store your user-uploaded media (also your static files if you want, otherwise use whitenoise). Django-storages makes it very easy.

how to port python sphinx-doc to github pages?

I just followed How to upload html documentation generated from sphinx to github? and everything works fine until I uploaded it to my github. I intend to make it as my personal website and I didn't make gh-pages branch. It looks something like this:
but it should look something like this, which I look from local:
Does anyone know what went wrong? I did include ".nojekyll" in the root. All the files generated directly from make html (however, I didn't upload files in "doctree"; only files in "html")
Thanks much!
The file name should be .nojekyll not .nojekyII :(

Deploying Django - Most static files are appearing except images

Most of my static files on my newly deployed Django website are working (CSS), but not the images. All the images are broken links for some reason and I cannot figure out why. I am serving my static files via Amazon AWS S3.
I believe all my settings are configured correctly as the collectstatic command works (and the css styling sheets are up on the web). What could be the problem?
It's probably impossible to give an accurate assessment with the limited info on your setup. If your css files are working what folder are they sitting in on your server?
Why not have images folder in the same directory and set that directory to your MEDIA_URL in your settings.py file?
In your browser check your images full path and compare that to your CSS files, where are they pointing, do you have a directory on your server where they are supposed to be? are you receiving an access denied if you try to directly put in that image url into your browser?

Categories