【发布时间】:2020-11-13 05:21:41
【问题描述】:
我正在尝试将我的 Laravel 7.29.3 应用部署到 Google App Engine 标准环境。我已按照此处https://cloud.google.com/community/tutorials/run-laravel-on-appengine-standard 的指导进行操作。但是,当我查看我的部署时,我得到一个 View[Welcome] not found 错误。我的 app.yaml 文件如下所示:
runtime: php72
env_variables:
## Put production environment variables here.
APP_KEY: YOUR_APP_KEY
APP_STORAGE: /tmp
VIEW_COMPILED_PATH: /tmp
SESSION_DRIVER: cookie
它是一个非常简单的 yaml 文件,因为我只使用欢迎视图和到联系页面的路由。请注意,我在这个版本中没有使用任何数据库。请在下面查看我的路由:
<?php
use Illuminate\Support\Facades\Route;
/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/
Route::get('/', function () {
return view('welcome');
});
Route::post('contact', 'ContactFormController@ContactForm');
我也在这里查看了这个问题:View [welcome] not found 但我仍然遇到同样的错误。根据我对@sllopis 评论的理解,我需要将 welcome.blade.php 文件放在 layouts 文件夹中。我已经这样做了,但仍然得到同样的错误。任何帮助将不胜感激。
谢谢
【问题讨论】:
-
它不会进入 layouts 文件夹,如果是这种情况,您必须将该视图引用为
layouts.welcome -
我知道这很简单,但我在您的 app.yaml 中看不到它。你确定你从提到的教程的第 2 点替换了
YOUR_APP_KEY吗?请不要发布它,只需检查并确认 -
@lagbox,你认为它会去哪里?
-
@vitooh,是的,我已将应用程序密钥放入我的 yaml 文件中。
标签: php laravel google-app-engine