Deploy to my server with Git - python

I have a development of a django project on my day-to-day laptop. Now I have put together a server with Ubuntu, nginx, gunicorn with postgreSQL.
I have pip't git on both my laptop and server. And done a 'git init' in my project on the laptop.
Now I am trying to push/deploy this on my local server.
I have done tons of commands that, more or less, look like this
git push --set-upstream ssh://admin#192.168.1.240/home/admin/Django/ master
Do not think I have to say that I am new to all this exciting stuff. It is very interesting, but now my head is foggy and I am stuck.
Pointers in right direction are much appreciated! =)

First you have to add and commit to the current local repo. Try 'git add' and 'git commit' for that.
Next, add the remote "server" machine, use "git remote add", such as:
git remote add origin 192.168.1.240:/home/admin/Django
Finally use the 'git push' command to push the local to the remote:
git push origin master

Related

How to see change on remote repo, which not in local repo?

I'm executing a command 'git push' and get error.
My remote repository is ahead of the local one.
I want to find out what changes have occurred on the remote repository.
Assuming you don't want to pull those changes yet, you can accomplish this with git log. First run git fetch to update your local refs. Then you'll want to run git log my-branch..origin/my-branch. This will show you commits on origin/my-branch (i.e. remote), which do not exist in your local repository.

trouble following digital ocean tutorial to deploy flask app to ubbuntu 18.04 with nginx gunicorn

i am trying to deploy a flask app onto aliyun ecs following this tutorial: https://www.digitalocean.com/community/tutorials/how-to-serve-flask-applications-with-gunicorn-and-nginx-on-ubuntu-18-04 sorry if any of these questions are stupid, i am an absolute new comer to nginx and gunicorn.
i have questions about a few steps of the tutorial.
the tutorial creates a sample flask project for demonstration, but i have one from a git repository. after i git clone that repository onto my server, i have an extra directory inside the "myproject" directory, which differs from the tutorial. is that ok? or will that cause problems.
the tutorial saids to configure flask to run with host = 0.0.0.0 so that it listens to all ips of that network, however, after i write app.run(host="0.0.0.0"), my flask app still runs with a specified host as the following image.
running at the server's ip instead of 0.0.0.0
the tutorial instructs me to cd into the directory where app.py is located, and bind to gunicorn. and then use a browser into my server ip at port 5000. howver, i cannot load that page and it saids this site cannot be reached, [server ip] took too long to respond.
then i continued with the tutorial, and the after the step that told me to sudo systemctl status myproject, instead of what the expected output is, i get the expected output plus the following message tagged to the end.
active status plug error message in the end
finally, after completing the tutorial, i receive 502 bad gateway instead of my site.
If you want to extract the contents of your GitHub repo into the current directory use - git clone <YOUR REPO URL> . Look at the (.) at the end it instructs git to clone in the same directory instead of creating a new folder.
You can try this - app.run(host='0.0.0.0', port='5000')
Site cannot be reached because your port is blocked and you will have to enable the incoming and outgoing connections and enable the port as well (A quick google search will give you commands) (Also try to ping your server with port number and check if the port is blocked or not).
The systemctl thing is there to run your app every time you restart you server. Even if you don't do this and don't restart your server then the above three steps are sufficient.

Is Heroku blocking my local git commands?

So i've run a heroku create command on my django repo, and currently it is living on Heroku. What I didnt do prior was create my own local git repo. I run git init, create a .gitignore to filter out my pycharm ide files, all the fun stuff.
I go to run git add . to add everything to the initial commit. Odd...it returns:
[1] 4270 killed git add.
So i run git add . again and get back this:
fatal: Unable to create /Users/thefromanguard/thefromanguard/app/.git/index.lock': File exists.
"Another git process seems to be running in this repository, e.g.
an editor opened by 'git commit'. Please make sure all processes
are terminated then try again. If it still fails, a git process
may have crashed in this repository earlier:
remove the file manually to continue."
So I go and destroy the file, run it again; same error. Removed the whole repo, repeated the process, still got the same message.
Is Heroku running in the background where ps can't see it?
I would start over.
Destroy the heroku app
heroku apps:destroy --app YOURAPPNAME
Remove the whole repo (I would even remove the directory)
Create new directory, copy files over (do NOT copy old git repo artifacts that may be left over, anything starting with .git)
Initialize your git repo, add files, and commit, then push upstream to your remote (like github, if you're using one) git init && git add . && git commit -m 'initial commit' and optionally git push origin master
Then perform the heroku create
That should remove the conflict.

upload via git: fatal: '/git/p/Boggle' does not appear to be a git repository

I am doing the reddit pygame boggle challenge. On my laptop it is in a directory called Boggler, but at sourceforge it is called pygame-boggle. When I do 'git push -u origin master' it gives the error in the title. What am I doing wrong? How do I get it to push?
I followed the instructions here: https://sourceforge.net/p/pygame-boggle/code/ref/master/
Have you initialized the repo? It seems like you haven't.
Run the command git init to set up a git repo. Then, add a remote to your repo (wherever it may be, github or bitbucket or any other site) by running the command
git remote add <url to remote here>

Create a branch on a remote repository with pygit2

I am using pygit2 to create a branch on a remote repository.
If it was in a local repository i would've used :
repo=pygit2.Repository(repo_url)
repo.create_branch('branch1', repo.head.get_object(), force=False)
But when i give the function Repository a remote url (not a path) it doesn't work, is there a solution ?
You will have to create your branch locally and then push it to the remote.
Once its pushed you can add remote with the branch name to track it locally (required on older git versions prior to 1.9).
The push command is here.
git push --set-upstream <remote> <branch>

Categories

Resources