在Python上运行的Discord应用程序无法与heroku一起使用吗?

时间:2018-09-01 20:25:57

标签: python heroku discord discord.py

有人制作了一个运行于Python代码上的discord机器人,但由于某种原因,它无法在heroku上运行。这是我得到的构建/错误日志。

  

----->应用程序与buildpack不兼容:https://buildpack-registry.s3.amazonaws.com/buildpacks/heroku/python.tgz          更多信息:https://devcenter.heroku.com/articles/buildpacks#detection-failure    !推送失败

但是我将python作为构建包添加了(带有来自Heroku的菜单/应用程序设置)

这些是有关要在本地计算机上运行代码的安装说明: >>Intructions for local machine

反正可以在Heroku上运行它还是该应用程序不兼容?

亲切的问候,

鲁本

1 个答案:

答案 0 :(得分:1)

您可以像下面的示例here一样在Github中托管代码,也可以使用Heroku的CLIGit

直接从计算机上载文件

之后转到

public class IndexModel : PageModel { private readonly AthlosifyWebArchery.Data.ApplicationDbContext _context; public IndexModel(AthlosifyWebArchery.Data.ApplicationDbContext context) { _context = context; } public string AtheleteNameSort { get; set; } public string GenderSort { get; set; } public string TotalRankingScoreSort { get; set; } public string CurrentSort { get; set; } public string CurrentFilter { get; set; } public class TournamentAtheleteViewModel { public string AtheleteName { get; set; } public string Gender { get; set; } public string Contingent { get; set; } public double TotalRankingScore { get; set; } } [BindProperty] public PaginatedList<TournamentAtheleteViewModel> TournamentAtheletes { get;set; } public async Task OnGetAsync(string sortOrder, string currentFilter, string searchString, int? pageIndex) { CurrentSort = sortOrder; AtheleteNameSort = String.IsNullOrEmpty(sortOrder) ? "atheletename_desc" : ""; GenderSort = sortOrder == "gender" ? "gender_desc" : "gender"; TotalRankingScoreSort = sortOrder == "totalrankingscore" ? "totalrankingscore_desc" : "totalrankingscore"; if (searchString != null) { pageIndex = 1; } else { searchString = currentFilter; } CurrentFilter = searchString; IQueryable<TournamentAtheleteViewModel> atheletes = _context.TournamentBatchItem .GroupBy(t => new { t.AtheleteName, t.Gender, t.Contingent }) .Select(t => new TournamentAtheleteViewModel { AtheleteName = t.Key.AtheleteName, Gender = t.Key.Gender, Contingent = t.Key.Contingent, TotalRankingScore = t.Sum(i => i.RankingScore) }); if (!String.IsNullOrEmpty(searchString)) { atheletes = atheletes.Where(s => s.AtheleteName.Contains(searchString) || s.Contingent.Contains(searchString)); } switch (sortOrder) { case "atheletename_desc": atheletes = atheletes.OrderByDescending(s => s.AtheleteName); break; case "gender": atheletes = atheletes.OrderBy(s => s.Gender); break; case "gender_desc": atheletes = atheletes.OrderByDescending(s => s.Gender); break; case "totalrankingscore": atheletes = atheletes.OrderByDescending(s => s.TotalRankingScore); break; case "totalrankingscore_desc": atheletes = atheletes.OrderBy(s => s.TotalRankingScore); break; default: atheletes = atheletes.OrderBy(s => s.AtheleteName); break; } int pageSize = 3; //TournamentAtheletes = await atheletes.AsNoTracking().ToListAsync(); TournamentAtheletes = await PaginatedList<TournamentAtheleteViewModel>.CreateAsync( atheletes.AsNoTracking(), pageIndex ?? 1, pageSize); } }

private string LogTelemetry(Exception ex) { var telemetryClient = new TelemetryClient(); var telemetry = new ExceptionTelemetry(ex); telemetryClient.TrackException(telemetry); //here I want to be able to return the telemetry's unique identifier } 选择Heroku --> Deploy,它将有说明

您必须创建一个名为Under Development Method的文件,在其中放置要使用的python模块的名称,而这并不是Python的标准部分。其次,您将需要一个名为Heroku Git的文件,该文件没有任何扩展名,该文件将决定您的动态范围。您的情况将是requirements.txt

我建议您看一下Github中的示例here,以获得更好的理解