- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
我正在尝试将我的 Assets 文件部署到 heroku,我在命令行界面中得到了这个输出:
(nrb_dev) ➜ neurorehabilitation_projects git:(master) ✗ heroku run python manage.py collectstatic
Running python manage.py collectstatic on neurorehabilitation.... up, run.5168
python: can't open file 'manage.py': [Errno 2] No such file or directory
(nrb_dev) ➜ neurorehabilitation_projects git:(master) ✗
manage.py
所在的目录/文件夹中。文件位于
DISABLE_COLLECT_STATIC
这样:
(nrb_dev) ➜ neurorehabilitation_projects git:(master) ✗ heroku config:set DISABLE_COLLECTSTATIC=1
Setting config vars and restarting neurorehabilitation... done
DISABLE_COLLECTSTATIC: 1
(nrb_dev) ➜ neurorehabilitation_projects git:(master)
git push heroku master
我可以部署 mi 应用程序:
remote:
remote:
remote: -----> Discovering process types
remote: Procfile declares types -> web
remote:
remote: -----> Compressing...
remote: Done: 46M
remote: -----> Launching...
remote: Released v15
remote: https://neurorehabilitation.herokuapp.com/ deployed to Heroku
remote:
remote: Verifying deploy... done.
To https://git.heroku.com/neurorehabilitation.git
* [new branch] master -> master
(nrb_dev) ➜ neurorehabilitation_projects git:(master) ✗
manage.py
相关的 heroku 操作。命令。
(nrb_dev) ➜ neurorehabilitation_projects git:(master) ✗ heroku run python manage.py migrate
Running python manage.py migrate on neurorehabilitation.... up, run.7836
Operations to perform:
Apply all migrations: contenttypes, auth, userprofiles, sessions, medical_encounter_information, admin
Running migrations:
Rendering model states... DONE
Applying contenttypes.0001_initial... OK
Applying contenttypes.0002_remove_content_type_name... OK
Applying auth.0001_initial... OK
Applying auth.0002_alter_permission_name_max_length... OK
Applying auth.0003_alter_user_email_max_length... OK
Applying auth.0004_alter_user_username_opts... OK
Applying auth.0005_alter_user_last_login_null... OK
Applying auth.0006_require_contenttypes_0002... OK
Applying auth.0007_alter_validators_add_error_messages... OK
Applying userprofiles.0001_initial... OK
Applying admin.0001_initial... OK
Applying admin.0002_logentry_remove_auto_add... OK
Applying userprofiles.0002_auto_20160225_2130... OK
Applying userprofiles.0003_auto_20160225_2130... OK
Applying medical_encounter_information.0001_initial... OK
Applying medical_encounter_information.0002_auto_20160225_2130... OK
Applying medical_encounter_information.0003_auto_20160225_2130... OK
Applying medical_encounter_information.0004_auto_20160225_2211... OK
Applying medical_encounter_information.0005_auto_20160225_2211... OK
Applying medical_encounter_information.0006_auto_20160225_2303... OK
Applying medical_encounter_information.0007_auto_20160229_2204... OK
Applying medical_encounter_information.0008_auto_20160229_2208... OK
Applying medical_encounter_information.0009_auto_20160301_0130... OK
Applying medical_encounter_information.0010_auto_20160301_0312... OK
Applying medical_encounter_information.0011_auto_20160301_1525... OK
Applying medical_encounter_information.0012_auto_20160301_1601... OK
Applying medical_encounter_information.0013_auto_20160301_1606... OK
Applying medical_encounter_information.0014_auto_20160301_1629... OK
Applying medical_encounter_information.0015_auto_20160301_1633... OK
Applying medical_encounter_information.0016_auto_20160301_1636... OK
Applying sessions.0001_initial... OK
Applying userprofiles.0004_auto_20160225_2211... OK
Applying userprofiles.0005_auto_20160225_2211... OK
Applying userprofiles.0006_auto_20160225_2303... OK
Applying userprofiles.0007_auto_20160229_2204... OK
Applying userprofiles.0008_auto_20160229_2208... OK
Applying userprofiles.0009_auto_20160301_0130... OK
Applying userprofiles.0010_auto_20160301_0312... OK
Applying userprofiles.0011_auto_20160301_1525... OK
Applying userprofiles.0012_auto_20160301_1601... OK
Applying userprofiles.0013_auto_20160301_1606... OK
Applying userprofiles.0014_auto_20160301_1629... OK
Applying userprofiles.0015_auto_20160301_1633... OK
Applying userprofiles.0016_auto_20160301_1636... OK
(nrb_dev) ➜ neurorehabilitation_projects git:(master)
(nrb_dev) ➜ neurorehabilitation_projects git:(master) ✗ heroku run python manage.py createsuperuser
Running python manage.py createsuperuser on neurorehabilitation.... up, run.5381
Username: bgarcial
Email address: bgarcial@sample.com
Password:
Password (again):
Superuser created successfully.
(nrb_dev) ➜ neurorehabilitation_projects git:(master) ✗
DISABLE_COLLECTSTATIC=1
(
我已经从我的设置仪表板 heroku 应用程序中删除了环境变量 )
heroku run python manage.py collectstatic
命令,我收到此通知:
(nrb_dev) ➜ neurorehabilitation_projects git:(master) ✗ heroku run python manage.py collectstatic
Running python manage.py collectstatic on neurorehabilitation.... up, run.9342
You have requested to collect static files at the destination
location as specified in your settings.
This will overwrite existing files!
Are you sure you want to do this?
Type 'yes' to continue, or 'no' to cancel: yes
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/app/.heroku/python/lib/python3.4/site-packages/django/core/management/__init__.py", line 353, in execute_from_command_line
utility.execute()
File "/app/.heroku/python/lib/python3.4/site-packages/django/core/management/__init__.py", line 345, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/app/.heroku/python/lib/python3.4/site-packages/django/core/management/base.py", line 348, in run_from_argv
self.execute(*args, **cmd_options)
File "/app/.heroku/python/lib/python3.4/site-packages/django/core/management/base.py", line 399, in execute
output = self.handle(*args, **options)
File "/app/.heroku/python/lib/python3.4/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 176, in handle
collected = self.collect()
File "/app/.heroku/python/lib/python3.4/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 98, in collect
for path, storage in finder.list(self.ignore_patterns):
File "/app/.heroku/python/lib/python3.4/site-packages/django/contrib/staticfiles/finders.py", line 112, in list
for path in utils.get_files(storage, ignore_patterns):
File "/app/.heroku/python/lib/python3.4/site-packages/django/contrib/staticfiles/utils.py", line 28, in get_files
directories, files = storage.listdir(location)
File "/app/.heroku/python/lib/python3.4/site-packages/django/core/files/storage.py", line 299, in listdir
for entry in os.listdir(path):
FileNotFoundError: [Errno 2] No such file or directory: '/app/neurorehabilitation/settings/static'
(nrb_dev) ➜ neurorehabilitation_projects git:(master) ✗
directories, files = storage.listdir(location)
File "/app/.heroku/python/lib/python3.4/site-packages/django/core/files/storage.py", line 299, in listdir
for entry in os.listdir(path):
FileNotFoundError: [Errno 2] No such file or directory: '/app/neurorehabilitation/settings/static'
static
目录
heroku run bash
检查我的 heroku 应用程序中的结构目录,我可以详细说明名为
/app
的根项目在 Heroku
(nrb_dev) ➜ neurorehabilitation_projects git:(master) ✗ heroku run bash
Running bash on neurorehabilitation.... up, run.5840
~ $ pwd
/app
~ $
/app
内容,我以类似的方式查看我的所有目录和文件,就像我在开发本地环境 django 项目中看到的一样
~ $ ls
avatars custom_storages.py django-multiselectfield-0.1.3.tar.gz functional_tests manage.py medical_encounter_information neurorehabilitation Procfile requirements requirements.txt runtime.txt userprofiles
/app/neurorehabilitation/settings/
但我可以看到不存在名为
static
的目录在里面,这就是 heroku 尝试搜索的方式:
~ $ cd /app/neurorehabilitation/settings/
~/neurorehabilitation/settings $ ls
base.py development.py __init__.py production.py staging.py testing.py
~/neurorehabilitation/settings $
neurorehabilitation/settings/static
的路径当这不是从原始 sproject 源设置时,这意味着我的机器中的项目在部署到 heroku 之前?
heroku run python manage.py collectstatic
这个命令尝试搜索一个目录 taht 不存在或不在我的项目的结构目录中设置?
/app/neurorehabilitation/settings/static
文件夹通过
heroku run bash
,但这不起作用
(nrb_dev) ➜ neurorehabilitation_projects git:(master) ✗ heroku run bash
Running bash on test-nrb.... up, run.1604
~ $ cd neurorehabilitation/settings/
~/neurorehabilitation/settings $ mkdir static
~/neurorehabilitation/settings $ ls -all
total 36
drwx------ 3 u51683 dyno 4096 Apr 1 15:07 .
drwx------ 5 u51683 dyno 4096 Apr 1 15:02 ..
-rw------- 1 u51683 dyno 8106 Apr 1 15:02 base.py
-rw------- 1 u51683 dyno 684 Apr 1 15:02 development.py
-rw------- 1 u51683 dyno 0 Apr 1 15:02 __init__.py
-rw------- 1 u51683 dyno 930 Apr 1 15:02 production.py
-rw------- 1 u51683 dyno 530 Apr 1 15:02 staging.py
drwx------ 2 u51683 dyno 4096 Apr 1 15:07 static
-rw------- 1 u51683 dyno 488 Apr 1 15:02 testing.py
~/neurorehabilitation/settings $ exit
exit
(nrb_dev) ➜ neurorehabilitation_projects git:(master) ✗ heroku run python manage.py collectstatic
Running python manage.py collectstatic on test-nrb.... up, run.5358
You have requested to collect static files at the destination
location as specified in your settings.
This will overwrite existing files!
Are you sure you want to do this?
Type 'yes' to continue, or 'no' to cancel: yes
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/app/.heroku/python/lib/python3.4/site-packages/django/core/management/__init__.py", line 353, in execute_from_command_line
utility.execute()
File "/app/.heroku/python/lib/python3.4/site-packages/django/core/management/__init__.py", line 345, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/app/.heroku/python/lib/python3.4/site-packages/django/core/management/base.py", line 348, in run_from_argv
self.execute(*args, **cmd_options)
File "/app/.heroku/python/lib/python3.4/site-packages/django/core/management/base.py", line 399, in execute
output = self.handle(*args, **options)
File "/app/.heroku/python/lib/python3.4/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 176, in handle
collected = self.collect()
File "/app/.heroku/python/lib/python3.4/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 98, in collect
for path, storage in finder.list(self.ignore_patterns):
File "/app/.heroku/python/lib/python3.4/site-packages/django/contrib/staticfiles/finders.py", line 112, in list
for path in utils.get_files(storage, ignore_patterns):
File "/app/.heroku/python/lib/python3.4/site-packages/django/contrib/staticfiles/utils.py", line 28, in get_files
directories, files = storage.listdir(location)
File "/app/.heroku/python/lib/python3.4/site-packages/django/core/files/storage.py", line 299, in listdir
for entry in os.listdir(path):
FileNotFoundError: [Errno 2] No such file or directory: '/app/neurorehabilitation/settings/static'
(nrb_dev) ➜ neurorehabilitation_projects git:(master)
git push heroku master
上传到平台时?
最佳答案
你有没有正确定义:
STATICFILES_DIRS
settings.py
内?
~/Software/h/hrku $ tail hrku/settings.py
USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.9/howto/static-files/
STATIC_URL = '/static/'
STATIC_ROOT = '/var/www/dj'
STATICFILES_DIRS = (os.path.join(os.path.dirname(__file__), '..', 'static'),)
STATICFILES_DIRS
只包含一个目录,该目录不存在:
~/Software/h/hrku $ ls -l /home/ozn/Software/h/hrku/static
ls: cannot access /home/ozn/Software/h/hrku/static: No such file or directory
collectstatic
失败:
~/Software/h/hrku $ python manage.py collectstatic
You have requested to collect static files at the destination
location as specified in your settings:
/var/www/dj
This will overwrite existing files!
Are you sure you want to do this?
Type 'yes' to continue, or 'no' to cancel: yes
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/home/ozn/.virtualenvs/h/lib/python3.5/site-packages/django/core/management/__init__.py", line 353, in execute_from_command_line
utility.execute()
File "/home/ozn/.virtualenvs/h/lib/python3.5/site-packages/django/core/management/__init__.py", line 345, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/ozn/.virtualenvs/h/lib/python3.5/site-packages/django/core/management/base.py", line 348, in run_from_argv
self.execute(*args, **cmd_options)
File "/home/ozn/.virtualenvs/h/lib/python3.5/site-packages/django/core/management/base.py", line 399, in execute
output = self.handle(*args, **options)
File "/home/ozn/.virtualenvs/h/lib/python3.5/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 176, in handle
collected = self.collect()
File "/home/ozn/.virtualenvs/h/lib/python3.5/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 98, in collect
for path, storage in finder.list(self.ignore_patterns):
File "/home/ozn/.virtualenvs/h/lib/python3.5/site-packages/django/contrib/staticfiles/finders.py", line 112, in list
for path in utils.get_files(storage, ignore_patterns):
File "/home/ozn/.virtualenvs/h/lib/python3.5/site-packages/django/contrib/staticfiles/utils.py", line 28, in get_files
directories, files = storage.listdir(location)
File "/home/ozn/.virtualenvs/h/lib/python3.5/site-packages/django/core/files/storage.py", line 299, in listdir
for entry in os.listdir(path):
FileNotFoundError: [Errno 2] No such file or directory: '/home/ozn/Software/h/hrku/static'
关于python - 将静态 Assets 从本地机器部署到 heroku - 无法打开文件 'manage.py' : [Errno 2] No such file or directory,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36272067/
我正在尝试使用 Heroku Scheduler 在已部署的 Heroku 应用程序中调用 HTTP 端点,它基本上以固定速率在 Heroku bash 上运行命令。 当我运行 $ heroku ru
我有一个在 Heroku 上运行的应用程序,其中有一些我想不时更改的设置,并且我想使用 Heroku 配置变量来存储这些设置,以便它们持久存在。 我知道我可以从 Heroku 仪表板或 Heroku
我从模板 reagent-frontend 创建了一个 ClojureScript Reagent 应用程序。如何将生产应用程序部署到 Heroku?在为生产构建后(lein package/lein
我正在尝试在 heroku 上添加信用卡,然后消息显示“无法验证您的卡,请稍后再试或联系您的金融机构寻求帮助” 最佳答案 这是因为您的银行拒绝付款。 检查您是否输入了所有正确的详细信息 查看您银行的最
首先为我的英语感到抱歉,因为它不是我的母语,我不习惯它,它可能很难理解。 我正在尝试将我的 spike 应用程序连接到 heroku 以获取长期葡萄糖数据。 我在没有“部署分支”步骤的情况下成功完成了
Ec2 实例小时按小时计算。如果你只是启动和关闭一个实例,它仍然算作一小时。 Heroku 如何处理这个?按分钟还是按小时? 让我们假设我的应用程序使用超过 750 免费 Dyno 小时限制 最佳答案
好奇 heroku 如何创建应用程序名称。应用程序名称通常是英文单词,例如bloom-peaks 或formal-trail。一家大公司的 IT 部门也是如此。是否有用于名称生成的 unix 库? 最
有没有人在 Heroku 上成功使用过 docsplit?它有许多二进制依赖项。我已经搜索过,但没有找到任何人这样做。教程会很棒,但我真的很好奇其他人是否成功。 最佳答案 我的搜索没有找到任何做过这件
我想将一个应用程序部署到需要能够生成加密安全随机数的 heroku。我可以使用哪些熵源? 最佳答案 你的 Heroku dyno 基本上是一个 Ubuntu 服务器虚拟机,所以你应该可以访问 /dev
Heroku 可以显示自定义维护页面: heroku config:set MAINTENANCE_PAGE_URL=http://some_server/my_page.html 这需要某些网站的存
我正在开始使用 Heroku,并担心它是否会因我犯的错误而向我收费。例如,填充数据库超过 5MB。 那么,有没有办法为 Heroku 或通知系统设置计费限制,以便在我超过价格限制时发送通知? 先感谢您
如何更新我的 Heroku ,我的 Windows 终端显示以下内容: » Warning: heroku update available from 7.47.7 to 7.52.0. 请帮忙
我在免费的 Dyno 上运行基于 NodeJS 的应用程序,连接到 mongohq-MongoDB。我想迁移它以使用爱好 Dyno,这样做的动机不仅是避免 sleep 时间,而且是为了实现更高的 HT
关闭。这个问题是off-topic .它目前不接受答案。 想改善这个问题吗? Update the question所以它是 on-topic对于堆栈溢出。 9年前关闭。 Improve this q
如何将我的生产数据库拉到 heroku 上的暂存服务器? 我有两个 Remote ,production 和 staging。 来自documentation看来我想运行 heroku pg:copy
我有一个域example.com,我想将它用于位于example.herokuapp.com 的rails-app,我很困惑如何去做。 Heroku says "Zone apex domains (
我有一个 sinatra 应用程序,其中有一个 yml 文件来设置环境变量,我使用此方法调用它们 module MyConfig def config environment = ENV["RA
根据各种因素,一整天中,我的应用程序的负载可能会出现非常极端的增加。 那时,我想自动增加测功机的数量。 我想增加加载时间。因此,如果加载页面需要X倍的时间,请增加测功力。否则,请往下走。 这样的东西存
我想知道使用heroku工具栏在heroku帐户之间进行切换的最佳方法是什么。 我曾经有一个个人的heroku帐户,它是我所有职业性的heroku应用程序的协作者。问题是当我想进行一些对财务有影响的更
是否可以停止部署到当前正在构建的 Heroku ( git push heroku )? 类似 heroku run stopit! 顺便提一句。成功部署后回滚不是我想要的。 最佳答案 首先,安装He
我是一名优秀的程序员,十分优秀!