Github pages 404, not loading repository content - github-pages

I created chineseantiquebuyers/chineseantiquebuyers.github.io repository, cloned it first then pushed dummy index.html but when checking chineseantiquebuyers.github.io I have 404.
Any idea how to fix it?

I tried few different things like, putting files in /docs directory, creating branch gh-pages, and dropping files from some jekyll project.
After dropping jekyll files I finally achieved not having 404 but repository content displayed.
I don't know what issue was.

Related

Github Pages 404 not found issue

I am having issues with my site. I have a repository for git hub pages Godoflaugh.github.io and I am trying to view a project I am working on https://godoflaugh.github.io/Module2/ . The issue is that I keep receiving the 404 file not found issue. My index.html file is in the root directory and I've re-pushed files to see if the commit would take effect and show anything. Please help!

Django collectstatic keeps waiting when run through Github Action

We are facing a very weird issue. We ship a django application in a docker container through Github Actions on each push. Everything is working fine except collectstatic.
We have the following lines at the end of our CD github action:
docker exec container_name python manage.py migrate --noinput
docker exec container_name python manage.py collectstatic --noinput
migrate works perfectly fine, but collectstatic just keeps on waiting if ran through the github action. If I run the command directly on the server then it works just fine and completes with in few minutes.
Can someone please help me figuring out what could be the issue?
Thanks in advance.
Now I am far from the most experienced but I did this recently and I have some suggestions of where to look. I'm definitely not the greatest authority though.
I wasn't using docker so I can't say anything about that. From the issues, I had here are some suggestions I can recommend to try.
Take note that all of this was for a self-hosted runner. Things would be very different otherwise.
Check to make sure STATIC_ROOT and MEDIA_ROOT variables are set correctly in the settings file.
If the STATIC and MEDIA root variables are environment variables make sure you are serving the correct environment variables file like a .env file which I used.
I used django-environ to serve my environment variables. From the docs, it says to have the .env file in the same directory as the settings file. Well if you are putting the project on a production server with github actions, you won't be able to put the .env file anywhere in the project because it will get overwritten every time new code is pushed.
So to fix that you need to specify the correct .env file from somewhere else on the server. Do that by specifying ENV_PATH.
https://django-environ.readthedocs.io/en/latest/
Under the section Multiple env files
Another resource that was helpful:
https://github.com/joke2k/django-environ/issues/143
I set up my settings file like how they did there.
I put my .env file in a proj directory I made in the virtualenvironment folder for the project.
I don't know if it's a good place to put it but that's how I did it. I didn't find much great info online for this stuff. Had to figure out a lot on my own.
Make sure the user which is running the github action has permissions to read the .env file.
Also like .env file, if you have the static files being collected into the base directory of your project you might have an issue with github actions overwriting those files every time new code is pushed. If you have a media directory where the user uploads files to then that will really be an issue because those files won't get overwritten. They'll just disappear.
Now if this was an issue it shouldn't cause github actions to just get stuck on the collect static command. It would just cause files to get overwritten every time the workflow runs and the media files will disappear.
If you do change the directory of where the static and media files are located as stated before, make sure all the variables for the paths are correct in the settings file and the .env file.
You will also need to update the nginx config file for the static and media root directories if you used nginx. Not sure about how apache does this.
You can do that with this command:
sudo nano /etc/nginx/sites-available/myproject
Don't forget to restart the nginx server after doing that.
If you are writing static and media files at a different location from the base project directory on the server, also check permissions on those directories. Make sure the user running the github action has permissions to write to those directories. I suspect that might cause it to hang but it very well might just cause an error.
Check all the syntax in the github actions yml file. Make sure everything is correct and it's not hanging cause it had an incomplete command or something like that.
But yeah, that's some things I had to take a look at. Honestly, none of this might be relevant for you. All of these issues should cause an error somewhere for the most part.
I couldn't really offer many external resources for you to look deeper into this because I'm just speaking from personal experience.
Hope I could help.
Heres my github repo for the project I did: https://github.com/pkudlanov/personal-portfolio-django
I hosted it on digitalocean on a linux server using nginx and gunicorn.

Django css not rendering from amazon server- 304 not modified

I am using a amazon server to host my Django app. It used to work fine but after some changes in the css files the app is not rendering those files anymore. I ran python manage.py collectstatic. Through firebug I can see the css files through up the error 304 not modified.
I guess this post address the issue but I couldnt understand it! What should I do to make so that static files render properly?
It is good practice to use something like /path/to/style.css?ver=CURRENT_VERSION to ensure that all users get recent version of CSS, JS and other static. CURRENT_VERSION could even be auto-populated from current Git commit id on deploy.

Using GitHub Pages, is it possible to specify the root web directory when not using Jekyll?

I'm using another static site generator and I'd like to be able to check-in the source files (in markdown) as well as the generated site to my username.github.com repo. So, much like Jekyll but I'm not using Jekyll. My structure is:
--source
1.md
2.md
--target
index.html
1.html
2.html
--css
app.css
index.html (GitHub Pages wants the root here)
GitHub Pages is serving the index.html and expects the rest of the site to be at the root. I would like the site to be served from target/index.html. This would allow me to create a source/3.md, generate it locally, and push both source/3.md and target/3.html.
The only ways I can think to do this is to:
have 2 repos - one for the markdown and generate to another for just the html.
have a branch that contains the markdown and commit the source to that branch and switch to master before committing the generated target html.
keep the markdown in the root (instead of 'source') and generate the html to the same root directory
as a long shot, adopt the Jekyll diretory structure and hope it doesn't interfere somehow by thinking it's a true Jekyll-style site
reviewing the jekyll docs https://help.github.com/articles/using-jekyll-with-pages it seems that isn't possible. The source directory can't be changed.

django filebrowser not allowing folders to be created and does not upload files

I'm trying to implement django-filebrowser into my latest app. I have grappelli installed also. The urls work fine for getting into filebrowser /admin/filebrowser/browse is what I have it set at.
The problem I am having is when it comes to trying to either add a folder or upload a file.
New Folder:
When I'm adding a folder an error is thrown stating:
Please correct the following errors.
Permission denied.
Now the permissions for the folder are fine. I don't understand why it won't allow me to upload files here.
drwxr-xr-x 2 naytive naytive 4096 Jan 18 08:32 uploads/
Upload File:
Normally when uploading a file, the filebrowser upload screen appears with a timer to upload success, however when I try to upload a file it just refreshes the page with url ending
?_save=Upload
It is getting to the point where I will just remove the module because it isn't doing as it is set up to be.
Any ideas?
EDIT: I think the uploading files side of things is caused by the original file permissions also. If we fix this error then perhaps the upload will work too.
If you use it on a server with apache, then you must give apache right to write in this folder (chown).
I had something similar. I gave permission to www-data user to the folder i wanted to upload to and it worked.