aldryn-newsblog featured image file missing - django

Am working on an aldryn-newsblog. it works well on my local host.
once i push the blog to heroku, thats when i get a problem.
Every time i add a new article, the article publishes very well with no problem. but after some time,say 20 mins the featured image just disappears. This forces me to edit the article again so as to add the image afresh.
image showing my file missing once i try to edit my article
What might be the problem? kindly assist.

Heroku uses ephemeral file system (files may be written to the app’s “tmp/” directory, but can be discarded by the system at any time)
Use a cloud storage service instead, see https://devcenter.heroku.com/articles/s3
Heroku docs: https://devcenter.heroku.com/articles/dynos#ephemeral-filesystem

Related

Google Built CentOS Image - Anyone have a download for this?

I've looked for this across the web a few times, and I feel like this hasn't been asked exactly, or I may just be getting bogged down with the wrong syntax. Hoping to get an easy answer here (yes, you can't get this, is an acceptable answer).
The variations from the base CentOS image are listed here: Link to GCP
However, they don't actually provide a download for this image. I'm trying to get a local VM running in VMWare with this image.
I feel as though they'd provide this to their clients to make it easier to prepare for use of their product, but I'm not finding it anywhere.
If anyone could toss me a link to a pre-configured CentOS ISO with the minor changes, I'd definitely take that as an alternative. I'm just not confident in my skills with Linux enough to configure the firewall properly :)
GCP doesn't support Google-provied images for exporting. However, they support exporting images for custom images.
I don't have any experience about image exporting, but I think this works.
Create custom images
You can create custom images based on your GCE VM instance.
Go navigation -> Compute engine -> images page.
You can create custom image via disk or snapshot in this page.
Select one and create a custom image.
Export your image
After creating custom image successfully, Go custom image page and click "export" on upper side.
Select export format and GCS destination. then click export.
Now you have an image in the Google Cloud storage.
Download image file and import to your local VM machine.

Image files no longer appear in production how to fix the problem

Before anyone can tell me how to put the other question solved? Hello local site works well, but in Heroku the picture is not displayed anymore
In production the static files are at the same level as the folder of the images according to the logging that's what breaks the problem thank you for your help.
the file upload images is img_url
Heroku has an ephemeral filesystem. Each running dyno is an independent container. So if you store a file on disk, it will be lost (and not recoverable) once the dyno restarts (which happens whenever the app is deployed, or once every 24 hours).
You need to store your files on a dedicated storage system, such as Amazon S3.
See https://help.heroku.com/K1PPS2WM/why-are-my-file-uploads-missing-deleted

Wagtail Admin Images Crash

Since I updated my production setup to Wagtail 1.11 I cannot load the admin page for images. Visiting /admin/images/ results in a 502 error. In my development setup I don't have the same problem
This is the result of a crash of the runner. The memory and CPU usage of the runners gets too high for the server to handle at which point they are killed. (Seen in top and restarts are shown in the logs)
This seems to be the same as https://github.com/wagtail/wagtail/issues/3575, but Wand is not used and no GIF images are uploaded to the system so this is not the cause. The following seemingly relevant python packages are used:
Django==1.11.3
gunicorn==19.7.1
Pillow==4.2.1
wagtail==1.11.1
Willow==0.4
The project is running on a fully updated Ubuntu 16.04 machine.
Does anyone have a suggestion of what can fix this bug?
Try removing some of the more recent or larger images and reloading the page. The problem could be the result of a corrupt or malicious image.
The easiest way to diagnose if this is the problem is to:
Move all images from the media/original_images folder to a backup folder.
Access the /admin/images page. If this was the problem the page should now load again.
Note all images that now do not have a thumbnail; these are the pictures crashing the application.
Move all picture except for the ones noted back into the media/original_images folder.
Except for the picture crashing your system, everything should now work similar to what it did before.

Malware/Adware on site deployed on AWS Elasticbeanstalk

I guess the title says it all.
I noticed some ads were popping up on a client's site we are currently developing. It only shows on this particular site. Not any other site. It is very annoying to put it mildly.
I thought removing it would be as easy as setting up a new environment on ElasticBeanstalk for it. I was wrong!
I have started a fresh instance for the application, scanned the project folder for malware before deploying, emptied the content of s3 bucket for static files. All these made no difference. The adware/malware is still there.
It has been driving me nuts for the past few days. Does anyone know how to resolve this kind of problem?
Mark B pointed me in the right direction.
I used inspect element to check the network processes of pages showing the Malware/Adware. It was after this i noticed a few asynchronous posts going to http://api.adsrun.net/post. Of course, i'm not making any post calls to this link. So i decided to inspect my JavaScript files as seen in View Page Source. Fortunately, it was in the last few lines of the second file i inspected. Immediately i deleted this file, normalcy returned to my web application.
It has been a very frustrating several hours. Thanks once again, Mark B for your suggestion.

Images disappear in Django app when deployed to Heroku

l have deployed my app to Heroku but some images are no longer being loaded.
For example, people's profile pics are not showing up, but if that person re-uploads one it will be visible. However, when they log out/in again, the picture is no longer there.
What would cause this type of behavior and how can I fix it? Locally everything works fine.
I found this information on http://www.gettingstartedwithdjango.com/introduction-and-launch.html#what-heroku-does-every-time-you-push-to-them-is
What Heroku does every time you push to them is:
Creates a new app space with its own virtual machine, virtual environment, and packages installed through pip.
Swaps the subdomain over to the new location.
Deletes the old app space.
What this means is that anything added to the app that is not in Git, won’t last between pushes. Even more, this exact same process happens once every 24 hours anyway, so uploaded files have to go somewhere other than Heroku.
You might look into this as a possible source of your issue.
Here is an answer from the pythonanywhere blog which may answer your question.
Basically, when going into production, setting (in settings.py) DEBUG = False raises a security lock on the file tampering with the image urls.
So basically a file path change is in order for the MEDIA_ROOT from development to production.
More information given on the blog here.
Hope this helps!