Localhost does not exist

I am trying to understand frappe framework so installed frappe and all the setup are done. After that when started bench by bench start command and when i try to access localhost:8000 but i get

This page isn’t working

localhost didn’t send any data.
ERR_EMPTY_RESPONSE

from chrome

and then i switched to terminal i am getting this error message

14:50:04 web.1            | Exception happened during processing of request from ('127.0.0.1', 49292)
14:50:04 web.1            | Traceback (most recent call last):
14:50:04 web.1            |   File "/usr/lib/python2.7/SocketServer.py", line 596, in process_request_thread
14:50:04 web.1            |     self.finish_request(request, client_address)
14:50:04 web.1            |   File "/usr/lib/python2.7/SocketServer.py", line 331, in finish_request
14:50:04 web.1            |     self.RequestHandlerClass(request, client_address, self)
14:50:04 web.1            |   File "/usr/lib/python2.7/SocketServer.py", line 652, in __init__
14:50:04 web.1            |     self.handle()
14:50:04 web.1            |   File "/home/vivin/meeting/frappe-bench/env/local/lib/python2.7/site-packages/werkzeug/serving.py", line 228, in handle
14:50:04 web.1            |     rv = BaseHTTPRequestHandler.handle(self)
14:50:04 web.1            |   File "/usr/lib/python2.7/BaseHTTPServer.py", line 340, in handle
14:50:04 web.1            |     self.handle_one_request()
14:50:04 web.1            |   File "/home/vivin/meeting/frappe-bench/env/local/lib/python2.7/site-packages/werkzeug/serving.py", line 263, in handle_one_request
14:50:04 web.1            |     return self.run_wsgi()
14:50:04 web.1            |   File "/home/vivin/meeting/frappe-bench/env/local/lib/python2.7/site-packages/werkzeug/serving.py", line 205, in run_wsgi
14:50:04 web.1            |     execute(self.server.app)
14:50:04 web.1            |   File "/home/vivin/meeting/frappe-bench/env/local/lib/python2.7/site-packages/werkzeug/serving.py", line 195, in execute
14:50:04 web.1            |     for data in application_iter:
14:50:04 web.1            |   File "/home/vivin/meeting/frappe-bench/env/local/lib/python2.7/site-packages/werkzeug/debug/__init__.py", line 284, in debug_application
14:50:04 web.1            |     app_iter = self.app(environ, start_response)
14:50:04 web.1            |   File "/home/vivin/meeting/frappe-bench/apps/frappe/frappe/middlewares.py", line 15, in __call__
14:50:04 web.1            |     return super(StaticDataMiddleware, self).__call__(environ, start_response)
14:50:04 web.1            |   File "/home/vivin/meeting/frappe-bench/env/local/lib/python2.7/site-packages/werkzeug/wsgi.py", line 599, in __call__
14:50:04 web.1            |     return self.app(environ, start_response)
14:50:04 web.1            |   File "/home/vivin/meeting/frappe-bench/env/local/lib/python2.7/site-packages/werkzeug/wsgi.py", line 599, in __call__
14:50:04 web.1            |     return self.app(environ, start_response)
14:50:04 web.1            |   File "/home/vivin/meeting/frappe-bench/env/local/lib/python2.7/site-packages/werkzeug/local.py", line 228, in application
14:50:04 web.1            |     return ClosingIterator(app(environ, start_response), self.cleanup)
14:50:04 web.1            |   File "/home/vivin/meeting/frappe-bench/env/local/lib/python2.7/site-packages/werkzeug/wrappers.py", line 291, in application
14:50:04 web.1            |     return f(*args[:-2] + (request,))(*args[-2:])
14:50:04 web.1            |   File "/home/vivin/meeting/frappe-bench/apps/frappe/frappe/app.py", line 53, in application
14:50:04 web.1            |     init_request(request)
14:50:04 web.1            |   File "/home/vivin/meeting/frappe-bench/apps/frappe/frappe/app.py", line 104, in init_request
14:50:04 web.1            |     frappe.init(site=site, sites_path=_sites_path)
14:50:04 web.1            |   File "/home/vivin/meeting/frappe-bench/apps/frappe/frappe/__init__.py", line 131, in init
14:50:04 web.1            |     local.conf = _dict(get_site_config())
14:50:04 web.1            |   File "/home/vivin/meeting/frappe-bench/apps/frappe/frappe/__init__.py", line 186, in get_site_config
14:50:04 web.1            |     sys.exit(1)
14:50:04 web.1            | SystemExit: 1
14:50:04 web.1            | ----------------------------------------

please help me to solve this

thanks

@vivin_joseph,

Did you make any changes in site_config.json? please validate the site_config.json on jsonlint.com

Also, please check your current site name in sites/current_site.txt exists in sites directory.

Thanks,
Makarand

1 Like

where is it located

@makarand_b,
current_site.txt doesnot exists. what to do?

This issue occurs when frappe framework is installed without any app. Follow the steps mentioned at
ERP app install steps

Hi there,
Link is outdated/broken.
please, update with latest link (anyone)

you may want to migrate your site to Python3 :wink:

Migrated already using bench migrate-env python3 command.(before bench start)

did you do bench update --patch?

after running: bench update --patch

Backing up sites…
Patching sites…
Migrating website123
Executing erpnext.patches.v11_0.rename_production_order_to_work_order in website123
rename_field: work_order not found in Timesheet
Traceback (most recent call last):

pymysql.err.InternalError: (1054, “Unknown column ‘production_order’ in ‘field list’”)

There maybe more than one site in your setup. use following commands for the site you have installed your erpnext and custom-app.
bench use site-name (eg:- bench use eg.com)
bench serve --port (port-number)(eg :- bench serve --port 9090)
These solved my same issue.
Hope this helps.

probably, your current_site.txt file is absent in sites/ folder.
create it and add the name of your site in it.

cd sites/
touch current_site.txt
sudo nano current_site.txt
xyz.localhost (name of the site)
save
run your bench again (bench start)

delete the current site from your local and database. then re-install properly.

2 Likes

A simple solution that I found was to

  • Keep the bench running with “bench start” in a terminal windows
  • Open a new terminal window
  • bench config serve_default_site on
  • bench use your_site_name
  • Return to the previous window and restart the bench

Now the page is being served. Hope this helps.

3 Likes

this works

This worked for me

bench use site_name
bench start

1 Like

If I have 2 site or more
How to solve that problem still happens to me?

how do you run 2 sites

are you using port or any other way?

Enable Multi tenancy for accessing 2sites.