Reputation: 2347
I have been coding small app in django for past few days. I would like to upload it on my server and make it work with domain name. I have debian vps. I would like to use git for managing my commits.
I ran "git init" in my localhost project folder. Then "git add ." and "git commit -m "initial commit."".
On my vps I created folder for my project called digrin and digrin.git in it. In digrin.git folder I ran "git init". (I've read not to use --bare option, not really sure why)
On my localhost I ran "git remote add prod [email protected]:/home/username/django/digrin/digrin.git". Then I called "git push prod" and everything was pushed to my server. But there are no files in my vps server, apart from digrin.git folder.
~/django/digrin/digrin.git$ tree . -a
.
├── branches
├── config
├── description
├── HEAD
├── hooks
│ ├── applypatch-msg.sample
│ ├── commit-msg.sample
│ ├── post-commit.sample
│ ├── post-receive.sample
│ ├── post-update.sample
│ ├── pre-applypatch.sample
│ ├── pre-commit.sample
│ ├── prepare-commit-msg.sample
│ ├── pre-rebase.sample
│ └── update.sample
├── info
│ └── exclude
├── objects
│ ├── 02
│ │ └── f2cbb7b882ed57a4fff43bdf532de94bad41d5
│ ├── 04
│ │ └── 0fa757722bceb0dc75c7b4821d00cc43606563
│ ├── 07
│ │ └── 995fe83329848b4c566ddcc86bd07dc32d82a5
│ ├── 08
│ │ └── 36976b8eb689c162cb119e87f9d88b6e8e29f8
│ ├── 0b
│ │ └── c47f33ef3284d5e352f39d2390e60ab8eb0197
│ ├── 0e
│ │ └── 214630c80b0ac44bab534eb5777ebc8e5608c2
│ ├── 0f
│ │ └── 39f2b804cf3aca9cec86c70385f94a3fbe45d3
│ ├── 16
│ │ └── 186a0a73592d9955ce1eaf6e01abcef4b91a0d
│ ├── 19
│ │ └── 05dafee5038810e3a4b76359657c84ab950482
│ ├── 1f
│ │ └── f6ccd34c2559a5914ef2bf8b94b0842e77efb8
│ ├── 31
│ │ └── dcc5c921b454750ed39146a69d5f20f124ae76
│ ├── 3c
│ │ └── a63a79be8303c5634c689109ef81be0d2a4e89
│ ├── 3f
│ │ └── 7ddb26699288f66324a42aec222dec3a1d1da5
│ ├── 41
│ │ └── ab8a60fff54bf8fc4b7e449e1292742b48153a
│ ├── 46
│ │ └── 9efc28186bb775016c4509371582e1a045e232
│ ├── 50
│ │ ├── 1deb776c16733b19f3509d86e125df78958261
│ │ └── 8c4b59b95c58159f24d73d75973d323b852e77
│ ├── 62
│ │ └── 9cb8e0bbc80fa914bbaa6bb4e7c482ee61823e
│ ├── 64
│ │ └── 89697c4e181c7c04f4c3709acb86f30ab2fdc9
│ ├── 68
│ │ └── 0e9a1c95cb2badc3b4e931809bf9890e3ce069
│ ├── 6d
│ │ ├── 0122a95fee544f0517e574db27e1157e55b3eb
│ │ └── bbc67e671100bea49b0311923635751300e770
│ ├── 6f
│ │ └── f65f4949e3faf53fc7fe676b119536ed3d642e
│ ├── 73
│ │ └── 8c6bbc0148a688c9f3d095c8829c83b422cc93
│ ├── 74
│ │ └── 046c5b6fb91da7ec24cecc18990b515fdfbde6
│ ├── 75
│ │ └── 02f9639bf9922da1f8adda0f84f5a65186b66e
│ ├── 80
│ │ └── a116dc6f0f01a9c4447e97b68530416a5a0a7a
│ ├── 8b
│ │ └── cf2d891595ddda0646c3afb522cf810c8034e1
│ ├── 8d
│ │ ├── 96d731137d9887d3712f0c9095beb6a597c4e9
│ │ └── d7ffe74193b9ca8005809f1d2752da93961d75
│ ├── 92
│ │ └── 2003b8433bcad6ce9778a37628d738faa26389
│ ├── 93
│ │ └── c2369e2c7ba17a20be2dac781a431b527113c8
│ ├── 99
│ │ └── cf77062c3eaa3db593faa57b4348cabf6c85b6
│ ├── 9c
│ │ └── 0c4b2f4225ea34cb53773725c992a8673d9d15
│ ├── 9d
│ │ └── 2e7e951f8bed7ec2184cbabd674b068cd5fa5c
│ ├── a4
│ │ └── c19994b6c951cc9e9d05c979c6c6d64313c702
│ ├── a5
│ │ └── a06bffb5d49f398b4ba0cadff6e2d5c603f832
│ ├── a9
│ │ └── 33e8f9c9ffde2a2f4605d55b4cfebeff5bdba1
│ ├── b0
│ │ ├── 2a8c17efa6ec97285dd88cc2287560a40c8a0e
│ │ └── 7740899baf224f24f108d9de205576427152c0
│ ├── b4
│ │ └── 33bd4b78f2b6fe832efbcb6469357cfa175aa9
│ ├── c1
│ │ └── 3017c7b797da485f6dd3237516e430445328d8
│ ├── c2
│ │ └── 8299cf77c851adb152aabe692d8ac427e9ad07
│ ├── c3
│ │ └── f1e49dd8bc831a28d8d8251cfcea5a703fb891
│ ├── c4
│ │ └── 7823b62c6c311e0ffd895261323211fc2b7a7b
│ ├── c7
│ │ └── de1c83e2d80fd128bfd8beca37ee3af5f637be
│ ├── c8
│ │ └── eb157cdf6c4f57946bc3b81a93a305d8597e7e
│ ├── c9
│ │ └── 910ece37dc43b86cec9b992ba0a5d814f034e1
│ ├── cb
│ │ ├── 14b0a3af6697fae2b69296ca13f2bd7ed1f508
│ │ ├── 5f1cba777ccb1531975d380655988d2a4cc5cb
│ │ └── b2b3d4d31a25c5a099980f43e58f0161393bf6
│ ├── cc
│ │ └── 8299d9f8fe971d739133e01f9081656f16ab5b
│ ├── d6
│ │ └── 46ec5a4f477815535917860dd98e8d229b848a
│ ├── d7
│ │ └── 2d4051bb91278b325d6a6f76ac11c1eb02638d
│ ├── de
│ │ └── f6a6a18457989c7d18825c7c1bbfeefc8b261d
│ ├── e2
│ │ └── 06d70d8595e2a50675ba11de48efcfa012497d
│ ├── e6
│ │ └── 9de29bb2d1d6434b8b29ae775ad8c2e48c5391
│ ├── f2
│ │ └── 6f127af6d72d0da4c27150fbba0161aa06dc59
│ ├── f5
│ │ └── aaab0b2db340c254e0067f393a5d7effc025ba
│ ├── fb
│ │ └── 49096539a37b557f05567657ef8929f4038b6a
│ ├── fe
│ │ └── 03268ba74295c4d3681752dd679d292e16598d
│ ├── ff
│ │ └── e1c1262efed9e5c59f8af54c778eb4f5008ca1
│ ├── info
│ └── pack
└── refs
├── heads
│ └── master
└── tags
65 directories, 77 files
How do I make it work? How do I get my localhost files uploaded to server and then redirect /var/www/digrin.tld to that home django folder?
Upvotes: 0
Views: 126
Reputation: 599470
You have two pretty big misconceptions here. The first is that, as Ngenator says in the comments, git doesn't work the way you think it does. Pushing to a git remote just pushes the raw git data: it doesn't make the actual files available on the server. You'd need to create a second clone elsewhere on that machine, add the existing remote to it, and pull every time you push an update from your development machine. You can use a git hook to automate that pull, if you like.
The second misconception is that deploying a Django site doesn't work the way you think it does either. You can't just "redirect /var/www/whatever" to a folder and expect Django to serve the site. You need to actually set up the proper server, be it Apache or whatever, and then configure it (probably via WSGI) to serve your site. The Django documentation explains this in detail.
Upvotes: 1