- 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/
我被难住了。如果我对文件路径进行硬编码,则此脚本在我的 Windows 机器上的 Eclipse 中运行良好。如果我尝试接受参数并在我的边缘节点(一个 linux 机器)上运行它,它不会抛出任何特定的
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 关闭 8 年前。 这个问题似乎不是关于 a specific programming problem,
我们最近将我们的基础架构从 Solaris(Oracle/Sun Java) 迁移到 AIX(IBM Java)。 我们的客户将使用我们共享的算法(AES)和 key 上传加密文件,一旦加密文件放置在
我想编写一个程序(java),它接受一个文件作为输入,对其进行加密(使用aes128)并通过ftp发送该加密文件,接收者接收它并使用 key 进行解密。我是初学者,有什么帮助可以做到这一点吗?非常感谢
我正在尝试将一些为 1c2 机器 (thumb) 编译的 DLL 导入 WinMobile 6.1 C# 智能设备项目。 然而,当我尝试将它们导入我的 C# 项目时,我得到“无法添加对...的引用”,
我正在寻找 FPGA + 机器。 它应该是入门级定价(例如不超过 200 美元)。 编辑:我想制作一个 ASM 图表并将 FPGA 编程为我在图表中指定的行为 最佳答案 你看过Arduino ? 关于
这是我想完成的: Write a program that stimulates a bean machine Your program should prompt the user to enter
我尝试使用以下命令在 Windows 10 上使用 hyperv 创建一台机器: docker-machine create --driver hyperv default 但它给了我: This m
我有个问题 我的问题是我有一个将 mapred.map.tasks 配置为10的作业(抓取工具),这意味着我的工作将一次创建10个映射器。但是我的集群将 mapred.tasktracker.map.
我正在尝试使用命令重新启动 Docker sudo docker restart a7f8ce75f51f 但我收到以下错误 Error response from daemon: Cannot re
在新机器上引导 Eclipse 是一个非常耗时的过程,您最终会问自己是否真的需要每个插件。但这些都很方便,并且有助于养成一致的习惯。 Eclipse 引导问题包括: 解释/记录需要发生的事情 粘贴正确
我们希望建立一个 Docker 开发节点,我们团队中的任何人都可以将东西部署到其中。 我使用 SSH 创建了一个新的 Docker 机器,如下所示: docker-machine create \
如果可能的话,我想使用 java.util.logging 来做到这一点,有什么想法吗?谢谢。 最佳答案 您可以尝试一下SLF4J . Simple Logging Facade for Java (
当 vagrant up 时,我们的 vagrant box 需要大约 1 小时才能提供第一次运行,在配置过程的最后,我想将盒子打包到本地文件夹中的图像,以便下次需要重建时将其用作基础盒子。我正在使用
我正在为我的图像处理项目构建一个 SVM 线性机,在其中提取正样本和负样本的特征并将其保存到目录中。然后,我使用这些功能训练 SVM,但收到一个无法调试的错误。下面是我用于训练分类器的 train-c
问题描述: 我要将MySQL server 5.7.11 (win32) 安装到Windows server 2012 中。服务器中安装了多个网络接口(interface)卡,我将安装多个绑定(bin
我想安排一台 (AWS) Linux 计算机启动、运行程序,然后自行关闭(以将成本保持在最低水平)。我可以放 mycommand; shutdown 在/etc/rc.local 文件中。但如果我需要
关闭。这个问题需要多问focused 。目前不接受答案。 想要改进此问题吗?更新问题,使其仅关注一个问题 editing this post . 已关闭 4 年前。 Improve this ques
如何将此文件的输出发送到另一台 Linux 计算机的主目录。 显然,我想发送此文件的输出: sed '/^\s*#/d;/^$/d' /etc/httpd/conf/httpd.conf 到 nati
我有一个 Linux 机器,我可以使用 SSH 进行 root 访问。 我想使用GDB来调试系统。 这是一个精简的 Debian 软件包;因此,我里面没有任何编译工具。 uname -a 给出: 2.
我是一名优秀的程序员,十分优秀!