- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我用命令禁用collectstatic
heroku config:set DISABLE_COLLECTSTATIC=1
成功将我的项目推送到 Heroku 后,手动 collectstatic
如下:
$ heroku run python manage.py collectstatic
不幸的是,Heroku 报告引用 manage.py
Running python manage.py collectstatic on ⬢ fierce-cove-94300... up, run.6296 (Free)
/app/.heroku/python/lib/python3.6/site-packages/psycopg2/__init__.py:144: UserWarning: The psycopg2 wheel package will be renamed from release 2.8; in order to keep installing from binary please use "pip install psycopg2-binary" instead. For details see: <http://initd.org/psycopg/docs/install.html#binary-install-from-pypi>.
""")
Traceback (most recent call last):
File "manage.py", line 22, in <module>
execute_from_command_line(sys.argv)
File "/app/.heroku/python/lib/python3.6/site-packages/django/core/management/__init__.py", line 364, in execute_from_command_line
utility.execute()
File "/app/.heroku/python/lib/python3.6/site-packages/django/core/management/__init__.py", line 356, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/app/.heroku/python/lib/python3.6/site-packages/django/core/management/base.py", line 283, in run_from_argv
self.execute(*args, **cmd_options)
File "/app/.heroku/python/lib/python3.6/site-packages/django/core/management/base.py", line 330, in execute
output = self.handle(*args, **options)
File "/app/.heroku/python/lib/python3.6/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 173, in handle
if self.is_local_storage() and self.storage.location:
File "/app/.heroku/python/lib/python3.6/site-packages/django/utils/functional.py", line 239, in inner
return func(self._wrapped, *args)
File "/app/.heroku/python/lib/python3.6/site-packages/django/utils/functional.py", line 35, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/app/.heroku/python/lib/python3.6/site-packages/django/core/files/storage.py", line 283, in location
return abspathu(self.base_location)
File "/app/.heroku/python/lib/python3.6/posixpath.py", line 371, in abspath
path = os.fspath(path)
TypeError: expected str, bytes or os.PathLike object, not tuple
settings.py
#Heroku Setting
cwd = os.getcwd()
if cwd == "/app" or cwd[:4] == "/tmp":
import dj_database_url
DATABASES = { #DATABASES plurual
"default": dj_database_url.config(default="postgres://localhost"),
}
#Honor the "X-Forwarded-Proto" header for request.is_secure().
SECURE_PROXY_SSL_HEADER = ("HTTP_X_FORWARDED_PROTO", 'https')
# Allow all host headers
ALLOWED_HOSTS = ['*']
#Static asset configuration
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
STATIC_ROOT = (BASE_DIR, "staticfiles")
STATICFILES_DIRS = (
os.path.join(BASE_DIR, 'static'),
)
如何解决这样的问题?
最佳答案
错误在您的 STATIC_ROOT
设置中。如错误消息所述,您传递的是元组而不是路径:
STATIC_ROOT = (BASE_DIR, "staticfiles")
将其更改为:
STATIC_ROOT = os.path.join(BASE_DIR, "staticfiles")
关于python - 在 Heroku 上部署时,报 TypeError : expected str, bytes or os.PathLike object, not tuple,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50381314/
我是 Java 新手,我遇到了这个我无法解决的问题。我继承了这个项目,并且我的 scriptlet 之一中有以下代码: DefaultLogger.logMessage("DEBUG path: "+
在做web应用的自动化测试时,定位元素是必不可少的,这个过程经常会碰到定位不到元素的情况(报selenium.common.exceptions.NoSuchElementException),一般
我之前已经这样做过,但令我惊讶的是 CListCtrl 不会以颜色显示文本。我在对话框上有 ListView 控件。我正在使用 VS2010,是否还缺少其他东西? void CGameView::On
我正在尝试计算 4 个表中每个学生的 GPA: Student(STUDENT_ID, STUDENT_LNAME, STUDENT_FNAME, MAJOR) Course(COURSE_NO, C
当我在 windows 和 mac 上使用 jasper 报告时它工作正常,当我将我的应用程序部署到 linux 机器 并尝试生成它抛出的报告时 net.sf.jasperreports.engine
我正在构建 iOS 应用并尝试实现应用内购买(非消费品)。 所有 bundle ID 等都已设置并正常工作,当我获取 Apple Store 服务器时,我可以看到我的产品有效。但是,在测试时,我在 p
我正在尝试使用非固定字符数组读取用户输入,但当我在键盘上输入内容时它只是软崩溃(没有崩溃窗口)。当我在在线 C 编译器上运行它时,它说 Segmentation fault (core dumped)
事实: 无根 podman 非常适合 uid 1480 无根 podman 为 uid 2088 失败 中央操作系统 7 内核 3.10.0-1062.1.2.el7.x86_64 podman 版本
根据 homebrew-brew 官方的解释得知,MongoDB 不再是开源的了,并且已经从 Homebrew中移除 #43770 正是由于 MongoDB 的商业化不太理想,所以它选择了闭源。所
我用命令禁用collectstatic heroku config:set DISABLE_COLLECTSTATIC=1 成功将我的项目推送到 Heroku 后,手动 collectstatic 如
代码如下: public class TryStuffOutHere { public static void main(String[] args) {
我已经设置了我的 redis 服务器,以便 CONFIG GET dir --> "/var/lib/redis" 和 CONFIG GET dbfilename --> "redis.rdb". 但
我是一名优秀的程序员,十分优秀!