from django.http import HttpResponse
def index(request):
return HttpResponse("<html><body>こんにちは!世界</body></html>")
このアプリのURLとビューの対応表です。
from django.urls import path
from . import views
urlpatterns = [
path('', views.index, name='index'),
]
このサイトのURLとアプリの対応表です。
"""sample_site URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/3.0/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-based views
1. Add an import: from other_app.views import Home
2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
Including another URLconf
1. Import the include() function: from django.urls import include, path
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import include, path
urlpatterns = [
path('sample_app/', include('sample_app.urls')),
path('admin/', admin.site.urls),
]
$ cd $HOME/public_html/(ドメイン)/
$ tar xvfz ダウンロードしたファイルのフルパス
キャッシュディレクトリの作成
$ cd gitlist
$ mkdir cache
設定ファイルの編集
$ cp -p config.ini-example config.ini
config.iniを以下のように編集
--- config.ini-example 2019-04-26 02:51:27.000000000 +0900
+++ config.ini 2020-01-31 10:15:55.815297245 +0900
@@ -1,7 +1,7 @@
[git]
client = '/usr/bin/git' ; Your git executable path
default_branch = 'master' ; Default branch when HEAD is detached
-repositories[] = '/home/git/repositories/' ; Path to your repositories
+repositories[] = '(ホーム)/(リポジトリの場所)/' ; Path to your repositories
; If you wish to add more repositories, just add a new line
; WINDOWS USERS
@@ -28,10 +28,10 @@
ssh_user_dynamic = false ; when enabled, ssh_user is set to $_SERVER['PHP_AUTH_USER']
; http remote
-show_http_remote = false ; display remote URL for HTTP
+show_http_remote = true ; display remote URL for HTTP
http_host = '' ; host to use for cloning via HTTP (default: none => uses gitlist web host)
use_https = true ; generate URL with https://
-http_url_subdir = 'git/' ; if cloning via HTTP is triggered using virtual dir (e.g. https://example.com/git/repo.git)
+http_url_subdir = 'gitrepos/git-http-backend.cgi/' ; if cloning via HTTP is triggered using virtual dir (e.g. https://example.com/git/repo.git)
; has to end with trailing slash
http_user = '' ; user to use for cloning via HTTP (default: none)
http_user_dynamic = false ; when enabled, http_user is set to $_SERVER['PHP_AUTH_USER']
確認
以下に設置されたことになる。
https://elephantcat.work/gitlist/
動いてるみたい。
VALUE SERVERでは動いてましたが、今はConoHa VPSに移行し、Giteaを導入したので消しています。
In this mode, the server will not request authentication until the client actually starts the object negotiation phase of the push, rather than during the initial contact. For this reason, you must also enable the http.receivepack config option in any repositories that should accept a push. The default behavior, if http.receivepack is not set, is to reject any pushes by unauthenticated users; the initial request will therefore report 403 Forbidden to the client, without even giving an opportunity for authentication.
SetEnvIf Request_URI "/git-receive-pack$" AUTHREQUIRED=yes
AuthType Basic
AuthName "Git Access"
Require group committers
...
Order deny,allow
Deny from env=AUTHREQUIRED
Satisfy any