{"title":"Troubleshooting","version":"dev","locale":"en","docname":"faq/troubleshooting","url":"/en/dev/faq/troubleshooting/","canonical":"https://djangodocs.dev/en/dev/faq/troubleshooting/","summary":"This page contains some advice about errors and problems commonly encountered during the development of Django applications. Problems running django-admin Link to…","html":"<h1>Troubleshooting<a class=\"heading-anchor\" href=\"#troubleshooting\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h1>\n<p>This page contains some advice about errors and problems commonly encountered\nduring the development of Django applications.</p>\n<section id=\"problems-running-django-admin\">\n<span id=\"troubleshooting-django-admin\"></span><h2>Problems running <code class=\"docutils literal notranslate\"><span class=\"pre\">django-admin</span></code><a class=\"heading-anchor\" href=\"#problems-running-django-admin\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<section id=\"command-not-found-django-admin\">\n<h3><code class=\"docutils literal notranslate\"><span class=\"pre\">command</span> <span class=\"pre\">not</span> <span class=\"pre\">found:</span> <span class=\"pre\">django-admin</span></code><a class=\"heading-anchor\" href=\"#command-not-found-django-admin\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p><a class=\"reference internal\" href=\"/en/dev/ref/django-admin/\"><span class=\"doc\">django-admin</span></a> should be on your system path if you\ninstalled Django via <code class=\"docutils literal notranslate\"><span class=\"pre\">pip</span></code>. If it’s not in your path, ensure you have your\nvirtual environment activated and you can try running the equivalent command\n<code class=\"docutils literal notranslate\"><span class=\"pre\">python</span> <span class=\"pre\">-m</span> <span class=\"pre\">django</span></code>.</p>\n</section>\n<section id=\"macos-permissions\">\n<h3>macOS permissions<a class=\"heading-anchor\" href=\"#macos-permissions\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>If you’re using macOS, you may see the message “permission denied” when\nyou try to run <code class=\"docutils literal notranslate\"><span class=\"pre\">django-admin</span></code>. This is because, on Unix-based systems like\nmacOS, a file must be marked as “executable” before it can be run as a program.\nTo do this, open Terminal.app and navigate (using the <code class=\"docutils literal notranslate\"><span class=\"pre\">cd</span></code> command) to the\ndirectory where <a class=\"reference internal\" href=\"/en/dev/ref/django-admin/\"><span class=\"doc\">django-admin</span></a> is installed, then\nrun the command <code class=\"docutils literal notranslate\"><span class=\"pre\">sudo</span> <span class=\"pre\">chmod</span> <span class=\"pre\">+x</span> <span class=\"pre\">django-admin</span></code>.</p>\n</section>\n</section>\n<section id=\"miscellaneous\">\n<h2>Miscellaneous<a class=\"heading-anchor\" href=\"#miscellaneous\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<section id=\"i-m-getting-a-unicodedecodeerror-what-am-i-doing-wrong\">\n<h3>I’m getting a <code class=\"docutils literal notranslate\"><span class=\"pre\">UnicodeDecodeError</span></code>. What am I doing wrong?<a class=\"heading-anchor\" href=\"#i-m-getting-a-unicodedecodeerror-what-am-i-doing-wrong\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>This class of errors happen when a bytestring containing non-ASCII sequences is\ntransformed into a Unicode string and the specified encoding is incorrect. The\noutput generally looks like this:</p>\n<div class=\"code-block\" data-language=\"pytb\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Pytb</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Pytb code\"><code><span class=\"x\">UnicodeDecodeError: &#39;ascii&#39; codec can&#39;t decode byte 0x?? in position ?:</span>\n<span class=\"x\">ordinal not in range(128)</span>\n</code></pre></div>\n<p>The resolution mostly depends on the context, however here are two common\npitfalls producing this error:</p>\n<ul class=\"simple\">\n<li><p>Your system locale may be a default ASCII locale, like the “C” locale on\nUNIX-like systems (can be checked by the <code class=\"docutils literal notranslate\"><span class=\"pre\">locale</span></code> command). If it’s the\ncase, please refer to your system documentation to learn how you can change\nthis to a UTF-8 locale.</p></li>\n</ul>\n<p>Related resources:</p>\n<ul class=\"simple\">\n<li><p><a class=\"reference internal\" href=\"/en/dev/ref/unicode/\"><span class=\"doc\">Unicode in Django</span></a></p></li>\n<li><p><a class=\"reference external\" href=\"https://wiki.python.org/moin/UnicodeDecodeError\">https://wiki.python.org/moin/UnicodeDecodeError</a></p></li>\n</ul>\n</section>\n</section>","rootId":"troubleshooting","toc":[{"title":"Problems running django-admin","anchor":"problems-running-django-admin","children":[{"title":"command not found: django-admin","anchor":"command-not-found-django-admin","children":[]},{"title":"macOS permissions","anchor":"macos-permissions","children":[]}]},{"title":"Miscellaneous","anchor":"miscellaneous","children":[{"title":"I’m getting a UnicodeDecodeError. What am I doing wrong?","anchor":"i-m-getting-a-unicodedecodeerror-what-am-i-doing-wrong","children":[]}]}],"breadcrumbs":[{"docname":"faq/index","title":"Django FAQ","url":"/en/dev/faq/"}],"prev":{"docname":"faq/contributing","title":"FAQ: Contributing code","url":"/en/dev/faq/contributing/"},"next":{"docname":"ref/index","title":"API Reference","url":"/en/dev/ref/"},"formats":{"html":"/en/dev/faq/troubleshooting/","markdown":"/en/dev/faq/troubleshooting.md","json":"/en/dev/faq/troubleshooting.json"},"source":"https://github.com/django/django/blob/main/docs/faq/troubleshooting.txt","official":"https://docs.djangoproject.com/en/dev/faq/troubleshooting/","inVersions":["dev","6.1","6.0","5.2","5.1","5.0","4.2","4.1","4.0","3.2","3.1","3.0","2.2","2.1","2.0","1.11","1.10","1.9","1.8"],"inLocales":["en"]}