http-status-code-404

Django: GET css returns 404?

无人久伴 提交于 2019-12-04 14:59:58
I am developing a Django site and after a series of edits I ran my server again when suddenly - no css! The server still displays the html site, of course, but the css all across the site is throwing a 404 error. My static files information in my settings.py wasn't edited at all: import os # hack to accommodate Windows CURRENT_PATH = os.path.abspath(os.path.dirname(__file__).decode('utf-8')).replace('\\', '/') STATIC_URL = '/static/' # Additional locations of static files STATICFILES_DIRS = ( os.path.join(CURRENT_PATH, 'static'), ) My base template does a simple call for the file based on the

Why am I getting 404 error in Flask?

我与影子孤独终老i 提交于 2019-12-04 14:07:56
I'm a Django developer learning Flask. I'm pretty new to how things work in Flask. I'm getting a 404 with the following code when I visit localhost:5000 . Could someone explain why I'm getting this: The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again. from flask import Flask from flask.ext.sqlalchemy import SQLAlchemy from datetime import datetime app = Flask(__name__) app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:////media/workdrive/workspace/purkinje/temp.db' app.debug = True db = SQLAlchemy(app) if __name__ == '__main__':

redirecting to homepage rather than 404 error page!

微笑、不失礼 提交于 2019-12-04 13:49:31
I'm working with PHP. I have an .htaccess file like below, and it redirects to homepage rather than 404 error page :/ what can be the problem here? Appreciate helps! thanks a lot! ErrorDocument 404 /new/err404.html RewriteEngine On RewriteBase /new/ RewriteRule ^login.html$ index.php?s=login&a=loginDo [QSA,L] RewriteRule ^logout.html$ index.php?s=login&a=logoutDo [QSA,L] RewriteRule ^([^/]*).html$ index.php?s=$1 [QSA,L] RewriteRule ^members/([^/]*)$ index.php?s=profile&username=$1 [QSA,L] RewriteRule ^([^/]*)/$ index.php?s=listing&search[cityString]=$1 [QSA,L] RewriteRule ^([^/]*)/([^/]*)/$

Serving static files for development mode in Django

断了今生、忘了曾经 提交于 2019-12-04 13:23:24
I'm having trouble serving static files in development mode in Django. I do know that this is not a setting that should be used in a production server, so don't worry. For now however I'd like to stick to it. The relevant parts of settings.py are: MEDIA_URL = '/media/' STATIC_URL = '/static/' MEDIA_ROOT = os.path.join(os.path.abspath(os.path.dirname(__file__) + '/..'), 'media') STATIC_ROOT = os.path.join(os.path.abspath(os.path.dirname(__file__) + '/..'), 'static') And of urls.py : urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) urlpatterns += static(settings

Mechanize/Ruby read source code of 404 page

青春壹個敷衍的年華 提交于 2019-12-04 12:24:20
All I'm doing is loading mechanize, and getting a page that returns 404. But that's exactly what I want. The 404 page has plenty of html I'd like to use in my example. a = mechanize.new a.get('http://www.youtube.com/watch?v=e4g8jriw4rg') a.page => nil I can't seem to find any further info on this. pguardiario You need to handle the exception: begin page = a.get 'http://www.youtube.com/watch?v=e4g8jriw4rg' rescue Mechanize::ResponseCodeError => e puts e.response_code # the status code as a string, e.g. "404" page = e.page end puts page.title This may have been the case when the answer was

404 pages and Lazy Loading in Angular2

只愿长相守 提交于 2019-12-04 12:04:31
I am unable to let my '404 pages' work using lazy loading modules. When I enter a random url in the browser I only see a blank page instead of my cool 404 page. Here is my routing config export const routes: Routes = [ { path: '', redirectTo: 'dashboard', pathMatch: 'full'}, { path: 'dashboard', loadChildren: 'app/dashboard/dashboard.module#DashboardModule'}, { path: 'buckets', loadChildren: 'app/buckets/buckets.module#BucketsModule'}, { path: '**', loadChildren: 'app/notfound/notfound.module#NotFoundModule'} ]; export const routing: ModuleWithProviders = RouterModule.forRoot(routes); When I

IIS overriding custom 404 error page in ASP.NET

放肆的年华 提交于 2019-12-04 11:54:35
I am trying to create a 404 error page and currently I have all of the following/tried all of the following to try and accomplish this. When the user types in : http://name/something.aspx It works just as its supposed to. But if the user types in: http://name/NotAFile with no .aspx then IIS7 takes matters into its own hands and I get the lovely error page that IIS7 comes with. The goal is that the site redirects with only a 404 status code (so not a 200, or a 302 redirect). I have tried in both the web config with: <customErrors mode="On" defaultRedirect="~/error/Default.aspx redirectMode=

ASP.NET MVC: How to serve content while returning status code 404? [duplicate]

好久不见. 提交于 2019-12-04 10:22:26
问题 This question already has an answer here : Closed 8 years ago . Possible Duplicate: How to configure IIS to serve my 404 response with my custom content? I would like to serve a user friendly "not found" page in my ASP.NET MVC application while providing a 404 status code. (based on this answer) I already have the mechanism how to catch an invalid route and the custom 404 page is served by my ErrorController/Handle404 action. My current implementation of Handle404 : public ActionResult

404 Not Found or Bad Request?

岁酱吖の 提交于 2019-12-04 10:20:09
问题 Let's say that we have the following REST call: GET api/companies/5 (get company with id 5) If company '5' doesn't exist, we would typically return a 404 Not Found response. But now, let's take this call: GET api/companies/5/invoices/10 (get invoice 10 from company 5) Now, if company '5' doesn't exist, do we still return a 404 Not Found ? Or should a 404 only be returned if the outer most resource can not be found (invoice 10, in this case). Would Bad Request perhaps be a better option? 回答1:

How to get the response content of an HTTP 404 response

若如初见. 提交于 2019-12-04 09:47:22
Is there an easier way of getting the content of an HTTP 404 response than directly accessing the host via tcp? This is a sample of a 404 response with content: HTTP/1.1 404 Object Not Found Server: CouchDB/1.3.0 (Erlang OTP/R15B03) Date: Wed, 24 Jul 2013 08:32:50 GMT Content-Type: text/plain; charset=utf-8 Content-Length: 41 Cache-Control: must-revalidate {"error":"not_found","reason":"missing"} The Rebol HTTP scheme really isn't designed with this in mind, it's geared toward reading content the way you would in a browser, not services over HTTP. In saying that, you can hack the protocol to