如何发布Django Web应用程序?发布django应用程序应遵循哪些步骤?有免费的主机托管吗?
预先感谢
答案 0 :(得分:2)
如果您想要简单和自动化,我是Amazon Web Services的忠实拥护者。您可以为Django和Elastic Beanstalk创建CodeStar项目。一切都由您完成,因此一旦您将代码提交到github存储库(它甚至可以使用弹性beantalk配置文件为您创建存储库),它就会构建,测试然后部署它。
最好的部分是,如果您是新会员,则可以使用Amazon的免费级别,因此它可能是免费的,也可能非常便宜。
请参阅此处以供参考: https://aws.amazon.com/codestar/faqs/
答案 1 :(得分:2)
我正在使用PythonAnyWhere托管我的项目。他们专门为python-Django / flask提供托管,并拥有一支非常敬业的团队。
您可以免费托管应用,但不能使用自己的域。要使用自定义域,您需要购买每月5美元起的付费计划。
他们的客户支持非常好。
托管的步骤如下:
-确保您的代码已准备好投入生产,即经过良好测试且没有错误。
-单独的生产和开发设置文件。在生产中,您需要设置who_ate_what <- function(data, col) {
col <- enquo(col)
col_name <- quo_name(col)
match_list <- data %>%
select(!!col) %>%
map(str_split, patter = ",") %>%
unlist() %>%
str_trim() %>%
na.exclude() %>%
unique()
match_list <- match_list[match_list != ""]
map_df(match_list, ~
data %>%
mutate(matches = str_c(!!col_name, "_", .x),
ind = case_when(str_detect(string = !!col, .x) ~ 1,
!str_detect(string = !!col, .x) ~ 0,
TRUE ~ NA_real_)
)) %>%
spread(matches, ind) %>%
select(-!!col)
}
。
-将您的代码推送到github。不要提交凭据或API密钥之类的敏感信息。将它们保存在.env文件中。
-在pythonanywhere服务器上创建帐户并创建数据库。
-克隆git repo。完成网络设置步骤。编辑wsgio设置文件。
-运行迁移。 DEBUG=false
。
-创建缓存表(如果有python manage.py migrate
。
-收集静态文件python manage.py createcachetable
。
-重新加载网络应用。
请参考this step by step article来设置一个免费帐户并在pythonanywhere服务器上托管Web应用。
答案 2 :(得分:0)
digitalocean.com非常适合托管。 link
我将它用于带有python3的Django 2.0。