I have a simple javascript projet created using npm. The source code is in a public github repository.
Here is the content of the repository
my-project
src
index.html
app.js
package.json
README.md
In my local environment I run it using lite-server by executing npm run dev.
I create gh-pages branch from my main branch, my code was automatically deployed after but when I visit the page it show the content of the README.md file.
How can I point to my index.html page instead so that my simple website is rendered ?
Do I have to absolutely move my index.html to the root directory ? Or is there other way without changing my project folder structre ?
=============== MY SOLUTION ===============
I just had to copy index.html and app.js at the root of the branch gh-pages.
You can only choose the root folder or /docs from repo settings.
https://docs.github.com/en/pages/getting-started-with-github-pages/configuring-a-publishing-source-for-your-github-pages-site
Related
I'm deploying a Django project on Centos 7 server using gitlab runner.
Each time I commit and push the project, gitlab runner tries to remove folders (such as the media folder) that are not in the gitlab repository(are on .gitignore).
I don't want gitlab runner to delete media files.
How can I ignore deleting some files and folders when gitlab runner starts its job?
Thanks in advance.
I found the answer.
I've put the media folder inside the project in the root static/media,
so every time gitlab runner deletes all the files and folders that are not in the project directory in the gitlab (also the media folder).
Simply, I put that media folder outside of the project.
former MEDIA_ROOT in settings.py:
MEDIA_ROOT= os.path.join(BASE_DIR, 'static/media/')
changed it to:
MEDIA_ROOT = '/home/gitlab-runner/builds/path-to-some-folder-outside-of-the-project-root/media/'
former nginx configuration:
location /media/ {
alias /home/gitlab-runner/builds/path-to-my-project/static/media/ ;
}
changed to:
location /media/ {
alias /home/gitlab-runner/builds/path-to-some-folder-outside-of-the-project-root/media/ ;
}
Hope it helps anybody that has this problem.
When I try to push my Django project into my gitlab repository it, all the files gets pushed properly except for the project folder it gets uploaded with a remove icon and text next to it that looks like that: # it 1080bae7
That looks like a submodule, or at least a gitlink (just a SHA1 entry)
Check if you see a .gitmodules in your repo.
If you don't see one, that means you have a nested git repo.
You can
convert that folder (nested repo) into an actual submodule, or
merge the nested repo into your main repo.
I renamed the folder, pushed it and renamed it again.
I've tried to find a concrete answer for this but failed. I'm rather new to openshift, django and git so I hope it's not too trivial and not a duplicate.
The situation is as follows:
1. I'm developing a Django based web application and source control it using git on a private bitbucket repo. I have my regular django application source tree as needed.
2. I wish to deploy my app on openshift which comes with a different directory tree. I've been able to successfully run this quickstart:
git://github.com/rancavil/django-openshift-quickstart.git
Basically what I try to achieve is a wrapper directory (and git project) which is based on the repo specified in #2. Within this wrapper one of the subdirectories (wsgi/my_project) should be based on my private repo specified in #1.
I wish to be able to pull recent changes from the private repo and then push and deploy to openshift these changes.
Any help would be greatly appreciated!
I was also struggling with openshift structure. But there is no need for doing the staff like you have proposed.
You can have any structure of a project you want. Openshift will need just wsgi/application or wsgi.py as an entry point. I think that having one more file in your project is hardly a problem.
My current structure for a project (got it running recently) is following:
|- .openshift (directory for build and deployment hooks like syncdb or collectstatic commands)
|- custom_project (directory that is you django project)
\- templates
|- settings.py
|- urls.py
|- manage.py
|- requirements.txt
|- wsgi.py
There is really no need to have project under wsgi folder. However there are few more pitfalls to be aware of. Like creating static folder or setting .htaccess for static files.
Including my wsgi.py:
#!/usr/bin/python
import os
import logging
try:
virtenv = os.environ['OPENSHIFT_PYTHON_DIR'] + '/virtenv/'
virtualenv = os.path.join(virtenv, 'bin/activate_this.py')
execfile(virtualenv, dict(__file__=virtualenv))
except (IOError, KeyError):
pass
os.environ.setdefault("DJANGO_SETTINGS_MODULE", 'custom_project.settings')
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
I have used a lot of resources to make my project running on openshift so I'm also including them for other.
bitbucket and openshit repos: Can I use my existing git repo with openshift?
Slides with necesary steps: http://appsembler.com/blog/paas-bakeoff-comparing-stackato-openshift-dotcloud-and-heroku-for-django-hosting-and-deployment/
And the most important one, the really well written step-by-step tutorial: http://www.paascheatsheet.com/#Introduction
I'm very new to Heroku and I've just pushed my Django app into Heroku. Does anyone know how to create a 'log' directory under '/app'? Is /app the top directory of my app?
Thanks
Is the log directory in your .gitignore file? If /log is an unversioned directory then K Z's answer should help regarding Heroku; unless something else is going on with Heroku and the log directory in your repo.
Regarding committing an empty directory
You cannot commit empty directories to git, but you can add a .gitignore file in a directory that ignores all files inside except itself. This would be as close as you can get to versioning an empty directory as I'm sure you don't want to version control your log files.
Make sure the log directory is not in your main .gitignore file. Then in your log directory create a new .gitignore that contains the following:
# Ignore everything in this directory
*
# Except this file
!.gitignore
You can check out Jamie Flournoy's answer here How can I add an empty directory to a Git repository?
To create a new directory you can simply create one in your local directory (i.e., cd app; mkdir log then commit & push to Heroku.
Whether /app is the top directory or not depends on your directory structure, normally it is the name of the app on Heroku that's set as the top directory. Though, if you are inside your git repository that's used for your Heroku app, you can find the root directory by:
git rev-parse --show-toplevel
which is a git command that tells you the top level directory of this git directory.
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.