Getting server error on viewing new doctype

I have created a new module named PhotoGallery from Module Def List-> New . Then i have created a new doctype named photoAlbum for this module from DoctypeList->new. Then in desktop the new module is shown , i opened the module and got the option document-> photoAlbum . but when i selected photoAlbum : i got the following error:

Traceback (innermost last):
 File "/home/frappe/frappe-bench/apps/frappe/frappe/", line 51, in   application
response = frappe.handler.handle()
 File "/home/frappe/frappe-bench/apps/frappe/frappe/", line 69, in handle
File "/home/frappe/frappe-bench/apps/frappe/frappe/", line 92, in     execute_cmd
ret =, **frappe.form_dict)
 File "/home/frappe/frappe-bench/apps/frappe/frappe/", line  754, in call
return fn(*args, **newargs)
 File "/home/frappe/frappe-bench/apps/frappe/frappe/desk/form/", line 63, in getdoctype
docs = get_meta_bundle(doctype)
File "/home/frappe/frappe-bench/apps/frappe/frappe/desk/form/", line 73, in get_meta_bundle
bundle = [frappe.desk.form.meta.get_meta(doctype)]
File "/home/frappe/frappe-bench/apps/frappe/frappe/desk/form/", line 20, in get_meta
meta = frappe.cache().hget("form_meta", doctype, lambda:   FormMeta(doctype))
File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/", line 123, in hget
value = generator()
File "/home/frappe/frappe-bench/apps/frappe/frappe/desk/form/", line 20, in 
meta = frappe.cache().hget("form_meta", doctype, lambda: FormMeta(doctype))
File "/home/frappe/frappe-bench/apps/frappe/frappe/desk/form/", line 32, in __init__
    File "/home/frappe/frappe-bench/apps/frappe/frappe/desk/form/", line 39, in load_assets
      File "/home/frappe/frappe-bench/apps/frappe/frappe/desk/form/", line 58, in add_code
path = os.path.join(get_module_path(self.module), 'doctype', scrub(
File "/home/frappe/frappe-bench/apps/frappe/frappe/modules/", line 29, in get_module_path
return frappe.get_module_path(module)
File "/home/frappe/frappe-bench/apps/frappe/frappe/", line 583, in get_module_path
return get_pymodule_path(local.module_app[module] + "." + module, *joins)
KeyError: u'photogallery'

Should i have to do some updations after doing these changes or is there anything else iam missing ???

Also after creating the doctype photoAlbum, i used the following commands to know whether the table has been created:

bench mysql desc tabphotoAlbum;

And i got the structure of the table as result .So the table has been created but still getting the error???

Hard to say what is wrong. Try clearing the cache and checking again.

i have added the code for new module in /home/frappe/frappe-bench/apps/erpnext/erpnext/config/ this location only. and restarted using bench restart command. But i have not made any changes in /home/frappe/frappe-bench/apps/frappe/frappe/config/ Is that causing this error???

i tested again but the same result, but i found that the module created has not been updated in the modules.txt file. So i added the name myself in the file (photogallery)and run the code then i got the error as ImportError: No module named photogallery. So i thing the problem is module is not properly created, but iam getting the module name on desktop??? Got any clue where i have gone wrong???

Do you have developer mode activated?

ok i made a mistake checked the logs and found that permission was denied for creating module. Solved the problem