尝试部署博客时为什么会出现HTTP错误?

时间:2019-02-18 02:56:39

标签: ruby-on-rails dokku

我目前正在尝试使用Dokku部署我的博客。我一直在遵循有关如何使用Dokku进行部署的指南,但是直到开始开始部署应用程序时,我才遇到HTTP错误。我一直在使用Mac开发我的博客。

My error message looks like this.

这是我正在使用的gem文件:

source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }

ruby '2.5.1'


# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 5.2.0'
# Use Puma as the app server
gem 'puma', '~> 3.11'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'mini_racer', platforms: :ruby

gem "loofah", ">= 2.2.3"

# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.2'
# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
gem 'turbolinks', '~> 5'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.5'
# Use Redis adapter to run Action Cable in production
# gem 'redis', '~> 4.0'
# Use ActiveModel has_secure_password
gem 'bcrypt', '~> 3.1.7'

# Use Bulma Rails to simply the CSS part of the site
gem "bulma-rails", "~> 0.7.1"

# Using font-awesome to get icons from font-awesome
gem "font-awesome-rails", '~> 4.7', '>= 4.7.0.4'

gem 'font-awesome-sass', '~> 5.5'

# Use Simple for Authentication
gem 'simple_form', '~> 4.0.0'

# FriendlyID
gem 'friendly_id', '~> 5.1.0'

# ACME-CLIENT
gem 'acme-client', '~> 2.0', '>= 2.0.1'

gem 'nokogiri', '~> 1.8', '>= 1.8.5'


gem 'sassc', '~> 1.12', '>= 1.12.1'

# Use ActiveStorage variant
gem 'mini_magick', '~> 4.8'

# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development

# Adds likes to comments and blog posts.
gem 'acts_as_votable', '~> 0.11.1'

#Devise - Authnetication Gem
gem 'devise', '~> 4.4', '>= 4.4.3'

#Pundit - Authorization Gem
gem 'pundit', '~> 1.1'




#CKEditor - To make my textarea and blog posts more robust
gem 'ckeditor', '~> 4.2', '>= 4.2.4', github: 'galetahub/ckeditor'

# Reduces boot times through caching; required in config/boot.rb
gem 'bootsnap', '>= 1.1.0', require: false

gem 'carrierwave', '~> 1.0'



group :development, :test do
  # Call 'byebug' anywhere in the code to stop execution and get a debugger console
  gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]

  # Call Rspec to test applications
  gem 'rspec-rails', '~> 3.7'

  #Factory Bot Rails
  gem 'factory_bot_rails', '~> 4.7'


end

group :development do
  # Access an interactive console on exception pages or by calling 'console' anywhere in the code.
  gem 'web-console', '>= 3.3.0'
  gem 'listen', '>= 3.0.5', '< 3.2'
  # Use the better errors gem to better locate stack trace errors.
  gem "better_errors"
  #binding-of-caller
  gem 'binding_of_caller', '~> 0.8.0'
  # Guard is used to simplify running the server
  gem 'guard'
  # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
  gem 'spring'
  gem 'spring-watcher-listen', '~> 2.0.0'
  # Automatically resets the server upon change the view.
  gem 'guard-livereload', '~> 2.5', '>= 2.5.2', require: false

  gem 'rb-readline'

  gem "letter_opener"
end



group :test do
  # Adds support for Capybara system testing and selenium driver
  gem 'capybara', '>= 2.15', '< 4.0'
  gem 'selenium-webdriver'

  #Database Cleaner - Used to clean the database upon finishing a test.
  gem 'database_cleaner'
  # Easy installation and use of chromedriver to run system tests with Chrome
  gem 'chromedriver-helper'
end



# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

gem 'pg'

# Require bootstrap
gem 'bootstrap', '~> 4.1.1'

#jQuery for Rails!
gem 'jquery-rails', '~> 4.3', '>= 4.3.3'

#Pagination for the site (Note: "kaminari" is Japanese for lightning.)
gem 'kaminari', '~> 1.1', '>= 1.1.1'

我还发现了一些问题,即Bundler 2.0.1似乎不起作用。如果您可能还需要解决类似代码段的问题,请告诉我。谢谢。

编辑:这是我的应用程序控制器

class ApplicationController < ActionController::Base
    include Pundit
    rescue_from Pundit::NotAuthorizedError, with: :user_not_authorized
    protect_from_forgery with: :exception
    before_action :configure_permitted_parameters, if: :devise_controller?




    protected

    def configure_permitted_parameters
      added_attrs = [ :username, :email, :password, :password_confirmation ]
      devise_parameter_sanitizer.permit :sign_up, keys: added_attrs
      devise_parameter_sanitizer.permit :account_update, keys: added_attrs
      devise_parameter_sanitizer.permit :sign_in, keys: added_attrs
    end

    private
    def user_not_authorized
      flash[:alert] = "You aren't authorized to go to that page. Contact TheBigL through email at master_biglee@live.ca."
      redirect_to (request.referrer || root_path)
    end

end

编辑:这是我的config / application.rb文件

require_relative 'boot'

require 'rails/all'

# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)

module Blog
  class Application < Rails::Application
    # Initialize configuration defaults for originally generated Rails version.
    config.load_defaults 5.2

    # Settings in config/environments/* take precedence over those specified here.
    # Application configuration can go into files in config/initializers
    # -- all .rb files in that directory are automatically loaded after loading
    # the framework and any gems in your application.
  end
end

0 个答案:

没有答案