On Heroku server media files getting deleted automatically after sometimes of deployment of web application - heroku

I am surprised, after successful deployment of a Django web application on heroku server.
I am able to view the media files just after the deployment but after sometimes i am unable to view it.
Error : GET https://mysite.herokuapp.com/media/files/testing_pphTYTV.mp4 404 (Not Found)
suggestions to resolve this is appreciated.....
i have used following line of code.
In settings.py file:
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
MEDIA_URL = '/media/'

Related

Netlify Redirect not working in my app with React Hooks

Hi i try connect my page in netlify with a service external but i dont now how configurate _redirects I put this:
/api/* http://www.webservice.com/:splat 200
And my app get webservice and put these url https://myapp.netlify.app/api/products
i want that put http://www.webservice.com/api/products
my _redirects is in public folder , my app is developer in react-hooks with webpack
plese someone cant help me,
Put the following in your netlify.toml file:
[[redirects]]
from = "/api/*"
to = "http://www.webservice.com/api/:splat"
status = 200
Then browse to https://myapp.netlify.app/api/products and it'll show you the page at http://www.webservice.com/api/products.

Cross Site Access Not Allowed (using Django 2.1.5)

I am working on an app using Django 2.1.5 with DRF 3.9.1 and on firefox browser console, I am getting this error:
downloadable font: download failed (font-family: "FontAwesome" style:normal weight:400 stretch:100 src index:2): bad URI or cross-site access not allowed source: http://softpro-admin-templates.websitedesignmarketingagency.com/assets/vendor_components/font-awesome/fonts/fontawesome-webfont.woff?v=4.7.0
After some googling, I came across this link https://github.com/ottoyiu/django-cors-headers/
As mentioned in the document I have installed the package and made the following modifications in the settings file:
CORS_ORIGIN_ALLOW_ALL = True
CORS_ALLOW_CREDENTIALS = True
MIDDLEWARE = [
'corsheaders.middleware.CorsMiddleware', #added at the top
-----
]
INSTALLED_APPS = [
'corsheaders',
]
But still, I am getting the same error. Can someone help me with this issue?
I'm assuming you're not the owner of softpro-admin-templates.websitedesignmarketingagency.com
Somewhere on your site, you're using fontawesome version 4.7.0 (A common icon font) but providing the above host as the source for this font. Due to CORS policies in most browsers, the host has to specifically allow this if the site the request originates from (yours) was fetched from a different domain (origin).
As the maintainer(s) of softpro-admin-templates.websitedesignmarketingagency.com likely don't know anything about your site, this hasn't been done. Change the src of fontawesome to your own server or the CDN suggested by fontawesome to solve this.

Images stopped loading on heroku

My Heroku app uses an image uploader for attaching images to a form. The images were saving and displaying on the page just fine, but then all of the sudden they won't load.
Sometimes the console says this:
Failed to load resource: the server responded with a status of 404 (Not Found)
And sometimes it says this:
GET https://safe-inlet-93558.herokuapp.com/uploads/grant/image/9/banner_banner_DSC_00134272684.jpg 404 (Not Found)
The heroku log says this:
ActionController::RoutingError (No route matches [GET] "/uploads/grant/image/10/robot9324566.jpg"
Here is my production.rb file:
config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
config.assets.compile = false
I have tried setting config.assets.compile to true, and config.serve_static_assets to true, but it made no difference.
I resolved this same issue by changing my image extension from .jpg to .png

Redirecting to API/Docs/index.html folder in Lumen

So i have an API created with Lumen with some documentation done with Apidoc outside of the public folder and i'd like to serve it when the user goes to the URL http://apidomain.com/docs
This is the structure of the app
ProjectRoot
->API
->Auth
->Docs
->v1
->app
->bootstrap
->database
->public
...
Is there any way to create a route that sends the user to API/Docs?
It's done, it was actually my bad, when trying to call the file via routes it actually messed up the filepath for the other files. So when i looked in the dev tools on chrome i noticed i was getting 404's on my js and css files, hence the failure to load the ApiDoc

How do I access My GRails Views pages in Browser

In GRails My views page locations are in C:\Program Files\Apache Software Foundation\Tomcat 7.0\webapps\myapp\WEB-INF\grails-app\views\index.gsp
I used tomcat 7.0 server I deployed my application as .war extension in webapps
When I try to access my index.gsp page from browser
(URL is: localhost:8080/myapp/index.gsp)
it is showing the following error
HTTP Status 404 - "/index.gsp" not found.
check your urlMapping.groovy, it should be
"/"(view:"/index")
"500"(view:'/error')
if this is same than hit just localhost:8080/myapp
it should work

Resources