Forums

git push does not work well!

Hi, I am using Github for my web app on Pythonanywhere and things were going well. I used to do a git pull from www locally and make my big changes, test them locally, and then (after making sure that www is up-to-date with git repo) I pushed my local code to www.

Recently I faced sth like this: Git - fatal: Unable to create '/path/my_project/.git/index.lock': File exists

so I did this: rm -f ./.git/index.lock

and continued using Git and it worked.

Now the problem is when I do a git pull locally from www (Pythonanywhere hosted web app), it seems to work but I can't see the same beautiful website locally. My CSS, Static, Media, Bootstrap etc. seem unlinked and what I see (locally) is just an ugly HTML website. I don't know if I'm missing anything or if my approach is correct!.

Any help is appreciated. Thank you

The index.lock issues sounds like you may have been running another git process at the same time, or perhaps you had a previous git command that crashed and left the index.lock behind.

As for the static files, it sounds like you've just not configured Django to serve them. Check the Django docs for the version that you're using to see how to do that.

it crashed I believe. As I was doing "git add ." and new files were coming in (as probably someone was browsing the website and database instances were changing". The git issue is solved now but I was wondering if it may create subsequent problems.

Regarding static files, I have the proper settings. Static files are served perfectly on pythonanywhere host but they just don't work when I "git pull" everything and try to run the web app locally (i.e. python manage.py runserver)

On PythonAnywhere static files may be served by PythonAnywhere and not by Django. In your local machine, you need to configure Django to serve them.