diff --git a/.gitignore b/.gitignore index 4875ad398..dbbaf135b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,3 @@ venv *.pyc -staticfiles .env -db.sqlite3 -getting-started/* \ No newline at end of file diff --git a/Procfile b/Procfile index 47a27c07f..0918754c4 100644 --- a/Procfile +++ b/Procfile @@ -1 +1 @@ -web: gunicorn gettingstarted.wsgi --log-file - +web: python manage.py $PORT diff --git a/Procfile.windows b/Procfile.windows index 69789e554..16c6fb476 100644 --- a/Procfile.windows +++ b/Procfile.windows @@ -1 +1 @@ -web: python manage.py runserver 0.0.0.0:5000 +web: web: python manage.py 5000 diff --git a/README.md b/README.md index 8cbdb7f82..e26e6f709 100644 --- a/README.md +++ b/README.md @@ -1,45 +1,16 @@ -# Python: Getting Started +# PythonでSSH Tunnel (ポートフォワーディング) -A barebones Django app, which can easily be deployed to Heroku. - -This application supports the [Getting Started with Python on Heroku](https://devcenter.heroku.com/articles/getting-started-with-python) article - check it out. - -## Running Locally - -Make sure you have Python 3.7 [installed locally](http://install.python-guide.org). To push to Heroku, you'll need to install the [Heroku CLI](https://devcenter.heroku.com/articles/heroku-cli), as well as [Postgres](https://devcenter.heroku.com/articles/heroku-postgresql#local-setup). - -```sh -$ git clone https://github.com/heroku/python-getting-started.git +## 使い方 +``` +$ git clone https://github.com/Utree/python-getting-started.git $ cd python-getting-started - -$ python3 -m venv getting-started -$ pip install -r requirements.txt - -$ createdb python_getting_started - -$ python manage.py migrate -$ python manage.py collectstatic - -$ heroku local ``` -Your app should now be running on [localhost:5000](http://localhost:5000/). - -## Deploying to Heroku +適宜、manage.py のIPアドレス、ユーザー名、パスワード、ポート番号は変更してください。 -```sh +``` $ heroku create $ git push heroku master - -$ heroku run python manage.py migrate +$ heroku ps:scale web=1 $ heroku open ``` -or - -[](https://heroku.com/deploy) - -## Documentation - -For more information about using Python on Heroku, see these Dev Center articles: - -- [Python on Heroku](https://devcenter.heroku.com/categories/python) diff --git a/app.json b/app.json index 8721c4994..f0ffbc6b4 100644 --- a/app.json +++ b/app.json @@ -1,21 +1,21 @@ { - "name": "Start on Heroku: Python", - "description": "A barebones Python app, which can easily be deployed to Heroku.", + "name": "PythonでSSHポートフォワーディング", + "description": "PythonでSSHポートフォワーディング(Heroku用)", "image": "heroku/python", - "repository": "https://github.com/heroku/python-getting-started", - "keywords": ["python", "django" ], - "addons": [ "heroku-postgresql" ], + "repository": "https://github.com/Utree/python-getting-started", + "keywords": ["python"], + "addons": [], "env": { "SECRET_KEY": { - "description": "The secret key for the Django application.", - "generator": "secret" + "description": "", + "generator": "" } }, "environments": { "test": { "scripts": { - "test-setup": "python manage.py collectstatic --noinput", - "test": "python manage.py test" + "test-setup": "python manage.py $PORT", + "test": "python manage.py $PORT" } } } diff --git a/gettingstarted/__init__.py b/gettingstarted/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/gettingstarted/settings.py b/gettingstarted/settings.py deleted file mode 100644 index 9ea552a0c..000000000 --- a/gettingstarted/settings.py +++ /dev/null @@ -1,119 +0,0 @@ -""" -Django settings for gettingstarted project. - -Generated by 'django-admin startproject' using Django 2.0. - -For more information on this file, see -https://docs.djangoproject.com/en/2.0/topics/settings/ - -For the full list of settings and their values, see -https://docs.djangoproject.com/en/2.0/ref/settings/ -""" - -import os -import django_heroku - - -# Build paths inside the project like this: os.path.join(BASE_DIR, ...) -BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) - - -# Quick-start development settings - unsuitable for production -# See https://docs.djangoproject.com/en/2.0/howto/deployment/checklist/ - -# SECURITY WARNING: keep the secret key used in production secret! -SECRET_KEY = "CHANGE_ME!!!! (P.S. the SECRET_KEY environment variable will be used, if set, instead)." - -# SECURITY WARNING: don't run with debug turned on in production! -DEBUG = True - -ALLOWED_HOSTS = [] - - -# Application definition - -INSTALLED_APPS = [ - "django.contrib.admin", - "django.contrib.auth", - "django.contrib.contenttypes", - "django.contrib.sessions", - "django.contrib.messages", - "django.contrib.staticfiles", - "hello", -] - -MIDDLEWARE = [ - "django.middleware.security.SecurityMiddleware", - "django.contrib.sessions.middleware.SessionMiddleware", - "django.middleware.common.CommonMiddleware", - "django.middleware.csrf.CsrfViewMiddleware", - "django.contrib.auth.middleware.AuthenticationMiddleware", - "django.contrib.messages.middleware.MessageMiddleware", - "django.middleware.clickjacking.XFrameOptionsMiddleware", -] - -ROOT_URLCONF = "gettingstarted.urls" - -TEMPLATES = [ - { - "BACKEND": "django.template.backends.django.DjangoTemplates", - "DIRS": [], - "APP_DIRS": True, - "OPTIONS": { - "context_processors": [ - "django.template.context_processors.debug", - "django.template.context_processors.request", - "django.contrib.auth.context_processors.auth", - "django.contrib.messages.context_processors.messages", - ] - }, - } -] - -WSGI_APPLICATION = "gettingstarted.wsgi.application" - - -# Database -# https://docs.djangoproject.com/en/2.0/ref/settings/#databases - -DATABASES = { - "default": { - "ENGINE" : "django.db.backends.sqlite3", - "NAME": os.path.join(BASE_DIR, "db.sqlite3") - } -} - -# Password validation -# https://docs.djangoproject.com/en/2.0/ref/settings/#auth-password-validators - -AUTH_PASSWORD_VALIDATORS = [ - { - "NAME": "django.contrib.auth.password_validation.UserAttributeSimilarityValidator" - }, - {"NAME": "django.contrib.auth.password_validation.MinimumLengthValidator"}, - {"NAME": "django.contrib.auth.password_validation.CommonPasswordValidator"}, - {"NAME": "django.contrib.auth.password_validation.NumericPasswordValidator"}, -] - - -# Internationalization -# https://docs.djangoproject.com/en/2.0/topics/i18n/ - -LANGUAGE_CODE = "en-us" - -TIME_ZONE = "UTC" - -USE_I18N = True - -USE_L10N = True - -USE_TZ = True - - -# Static files (CSS, JavaScript, Images) -# https://docs.djangoproject.com/en/2.0/howto/static-files/ - -STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles') -STATIC_URL = "/static/" - -django_heroku.settings(locals()) diff --git a/gettingstarted/static/humans.txt b/gettingstarted/static/humans.txt deleted file mode 100644 index e69de29bb..000000000 diff --git a/gettingstarted/urls.py b/gettingstarted/urls.py deleted file mode 100644 index 13b759582..000000000 --- a/gettingstarted/urls.py +++ /dev/null @@ -1,21 +0,0 @@ -from django.urls import path, include - -from django.contrib import admin - -admin.autodiscover() - -import hello.views - -# To add a new path, first import the app: -# import blog -# -# Then add the new path: -# path('blog/', blog.urls, name="blog") -# -# Learn more here: https://docs.djangoproject.com/en/2.1/topics/http/urls/ - -urlpatterns = [ - path("", hello.views.index, name="index"), - path("db/", hello.views.db, name="db"), - path("admin/", admin.site.urls), -] diff --git a/gettingstarted/wsgi.py b/gettingstarted/wsgi.py deleted file mode 100644 index 3c528d7ce..000000000 --- a/gettingstarted/wsgi.py +++ /dev/null @@ -1,16 +0,0 @@ -""" -WSGI config for gettingstarted project. - -It exposes the WSGI callable as a module-level variable named ``application``. - -For more information on this file, see -https://docs.djangoproject.com/en/2.1/howto/deployment/wsgi/ -""" - -import os - -os.environ.setdefault("DJANGO_SETTINGS_MODULE", "gettingstarted.settings") - -from django.core.wsgi import get_wsgi_application - -application = get_wsgi_application() diff --git a/hello/__init__.py b/hello/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/hello/admin.py b/hello/admin.py deleted file mode 100644 index 8c38f3f3d..000000000 --- a/hello/admin.py +++ /dev/null @@ -1,3 +0,0 @@ -from django.contrib import admin - -# Register your models here. diff --git a/hello/migrations/0001_initial.py b/hello/migrations/0001_initial.py deleted file mode 100644 index 99c4a82a5..000000000 --- a/hello/migrations/0001_initial.py +++ /dev/null @@ -1,23 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.1 on 2016-01-27 21:54 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - initial = True - - dependencies = [ - ] - - operations = [ - migrations.CreateModel( - name='Greeting', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('when', models.DateTimeField(auto_now_add=True, verbose_name=b'date created')), - ], - ), - ] diff --git a/hello/migrations/__init__.py b/hello/migrations/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/hello/models.py b/hello/models.py deleted file mode 100644 index 8229092ef..000000000 --- a/hello/models.py +++ /dev/null @@ -1,5 +0,0 @@ -from django.db import models - -# Create your models here. -class Greeting(models.Model): - when = models.DateTimeField("date created", auto_now_add=True) diff --git a/hello/static/lang-logo.png b/hello/static/lang-logo.png deleted file mode 100644 index f04aff1e3..000000000 Binary files a/hello/static/lang-logo.png and /dev/null differ diff --git a/hello/templates/base.html b/hello/templates/base.html deleted file mode 100644 index 97ec07386..000000000 --- a/hello/templates/base.html +++ /dev/null @@ -1,83 +0,0 @@ - - -
-
-
- This is a sample Python application deployed to Heroku. It's a reasonably simple app - but a good foundation for understanding how to get the most out of the Heroku platform.
- Getting Started with Python - Source on GitHub -git clone https://github.com/heroku/python-getting-started.git - this will create a local copy of the source code for the appcd python-getting-started - change directory into the local source code repositoryheroku git:remote -a <your-app-name> - associate the Heroku app with the repository