Getting server error on viewing new doctype

halooo,
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/app.py", line 51, in   application
response = frappe.handler.handle()
 File "/home/frappe/frappe-bench/apps/frappe/frappe/handler.py", line 69, in handle
execute_cmd(cmd)
File "/home/frappe/frappe-bench/apps/frappe/frappe/handler.py", line 92, in     execute_cmd
ret = frappe.call(method, **frappe.form_dict)
 File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line  754, in call
return fn(*args, **newargs)
 File "/home/frappe/frappe-bench/apps/frappe/frappe/desk/form/load.py", line 63, in getdoctype
docs = get_meta_bundle(doctype)
File "/home/frappe/frappe-bench/apps/frappe/frappe/desk/form/load.py", line 73, in get_meta_bundle
bundle = [frappe.desk.form.meta.get_meta(doctype)]
File "/home/frappe/frappe-bench/apps/frappe/frappe/desk/form/meta.py", line 20, in get_meta
meta = frappe.cache().hget("form_meta", doctype, lambda:   FormMeta(doctype))
File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/redis_wrapper.py", line 123, in hget
value = generator()
File "/home/frappe/frappe-bench/apps/frappe/frappe/desk/form/meta.py", line 20, in 
meta = frappe.cache().hget("form_meta", doctype, lambda: FormMeta(doctype))
File "/home/frappe/frappe-bench/apps/frappe/frappe/desk/form/meta.py", line 32, in __init__
self.load_assets()
    File "/home/frappe/frappe-bench/apps/frappe/frappe/desk/form/meta.py", line 39, in load_assets
self.add_code()
      File "/home/frappe/frappe-bench/apps/frappe/frappe/desk/form/meta.py", line 58, in add_code
path = os.path.join(get_module_path(self.module), 'doctype', scrub(self.name))
File "/home/frappe/frappe-bench/apps/frappe/frappe/modules/__init__.py", line 29, in get_module_path
return frappe.get_module_path(module)
File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", 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/desktop.py 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/desktop.py. 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?

https://kb.frappe.io/kb/app-development/how-enable-developer-mode-in-frappe

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