Skip to content

Commit

Permalink
Merge pull request #25 from AnYeMoWang/add_asterisk_to_settings
Browse files Browse the repository at this point in the history
Add * to ALLOWED_HOSTS
  • Loading branch information
TuuuNya committed Jan 10, 2019
2 parents 4b37daa + 1e2b049 commit c067586
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .env.docker
@@ -1,6 +1,6 @@
# Django Settings
DEBUG="True" # Django后台是否以debug模式运行, 可选True/False
ALLOWED_HOSTS="127.0.0.1,localhost" # 配置Django Allowed_Hosts
ALLOWED_HOSTS="*,127.0.0.1,localhost" # 配置Django Allowed_Hosts, 如果DEBUG为False, 需要将访问的host地址添加进来,如'localhost,github.vipkid.com.cn'

# Database Settings
# DATABASE choice is mysql or sqlite
Expand Down
2 changes: 1 addition & 1 deletion .env.sample
@@ -1,6 +1,6 @@
# Django Settings
DEBUG="True" # Django后台是否以debug模式运行, 可选True/False
ALLOWED_HOSTS="127.0.0.1,localhost" # 配置Django Allowed_Hosts
ALLOWED_HOSTS="*,127.0.0.1,localhost" # 配置Django Allowed_Hosts, 如果DEBUG为False, 需要将访问的host地址添加进来,如'localhost,github.vipkid.com.cn'

# Database Settings
# DATABASE choice is mysql or sqlite
Expand Down
3 changes: 1 addition & 2 deletions README.md
Expand Up @@ -72,7 +72,7 @@
```
# Django Settings
DEBUG="True" # Django后台是否以debug模式运行, 可选True/False
ALLOWED_HOSTS="127.0.0.1,localhost" # 配置Django Allowed_Hosts
ALLOWED_HOSTS="*,127.0.0.1,localhost" # 配置Django Allowed_Hosts, 如果DEBUG为False, 需要将访问的host地址添加进来,如'localhost,github.vipkid.com.cn'
# Database Settings
# DATABASE choice is mysql or sqlite
Expand Down Expand Up @@ -102,7 +102,6 @@ EMAIL_USE_SSL="False" # 与SMTP服务器通信时是否使用SSL(安全)连
INIT_ADMIN_USERNAME="admin" # 初始化系统用户使用的用户名
INIT_ADMIN_PASSWORD="password123!@#" # 初始化系统用户使用的用户密码
```


Expand Down
Expand Up @@ -6,7 +6,7 @@

class TaskSerializer(serializers.ModelSerializer):
keywords = serializers.CharField(required=True, label='关键词', help_text='多个关键词换行分隔')
name = serializers.SlugField(max_length=50, allow_unicode=True, validators=[UniqueValidator(queryset=Task.objects.all())], label=u'任务名称')
name = serializers.CharField(required=True, max_length=50, validators=[UniqueValidator(queryset=Task.objects.all())], label=u'任务名称')
pages = serializers.IntegerField(default=5, allow_null=False, label='爬取页数', help_text='默认为5, 0为搜索全部')
ignore_org = serializers.CharField(required=False, allow_null=True, allow_blank=True, label='忽略用户')
ignore_repo = serializers.CharField(required=False, allow_null=True, allow_blank=True, label='忽略仓库')
Expand Down
4 changes: 4 additions & 0 deletions server/github_monitor/settings.py
Expand Up @@ -29,6 +29,10 @@

ALLOWED_HOSTS = os.environ.get('ALLOWED_HOSTS').split(",")

if not DEBUG:
if '*' in ALLOWED_HOSTS:
ALLOWED_HOSTS.remove('*')


# Application definition

Expand Down
2 changes: 1 addition & 1 deletion server/requirements.pip
Expand Up @@ -2,7 +2,7 @@ django==2.0
django-filter==2.0.0
djangorestframework==3.8.2
django-cors-headers==2.4.0
requests==2.19.1
requests[security]
mysqlclient==1.3.13
uWSGI==2.0.17.1
python-dateutil==2.7.3
Expand Down

0 comments on commit c067586

Please sign in to comment.