Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 3 years ago.
This post was edited and submitted for review 3 months ago and failed to reopen the post:
Original close reason(s) were not resolved
Improve this question
I ran into this error after executing python manage.py runserver. This was just after pulling the repository after not having worked on it in a while. I tried checking to see that I had the dependencies installed and that my virtual environment was active and I still get the error.
The last line of the error (also the title of the question) is
OSError: [WinError 123] The filename, directory name, or volume label syntax is incorrect: '<frozen importlib._bootstrap>'
See the screenshot below:
I am new to Django so I have no idea what the cause of this error is.
I had the same issue here. After having suffering for a few hours stuck, I figured out the reason. It's very basic.
We forgot to run the migrate commands.
To fix, run the below commands in order:
python manage.py migrate
python manage.py makemigrations
python manage.py migrate
While the error notification is not relavance but this fix the error anyway :v.
You can read further information about migration Here.
The same issue is also occurred when someone misspell filename, directory name or app name... for example when someone create an app by the name of users and then he/she want to enlist the app in the INSTALLED_APPS List available in the setting.py file in misspell way like ............ users.app.UsersConfig instead of users.apps.UsersConfig
if you have virtualenv managing your packages make sure that is activated it before you run your app.
I am sensing that you are trying to import bootstrap files for your website.This can be conveniently done by adding the hyperlink from the bootstrap cdn on your base template.
Also you can download the boostrap package and copy the css and js files under the static folder in your project.
first but not always, it seems you have deleted a file/folder from your project. if so, remember to delete the path that was serving that folder "path in the project urls.py"
In my case, I was missing the \ when using multiple lines to import:
from .models import Country, State, Locality, Address,\
PercentageAmount, Condominium, Condominium_expenses_report,\
FunctionalUnit, Percentage, FunctionalUnit_expenses_report,\
Expense, Bill, Judgment, Insurance, Concept
I had the same error and I also do not have any bootstrap included in my application. In my case the virtualenv server stopped running. Just reboot the Django server and you are good to go again.
I made the same mistake and to solve the issue try this
from django.http import HttpResponse
Related
I already have a django project and all files created, but I am trying to deploy to a server. I moved files over to server using FileZilla and I am in putty now trying to django-admin startproject practice ~/practice but I get a command error stating that this already exists which obviously it does but then if I want to manage.py makemigrations I get a -bash: Permission denied and I am guessing that is because I have not started django project here on putty??? I hope there is enough info here to explain my issue. Any help is appreciated
You need run python manage.py runserver in the correct folder with admin permisions.
I have been working on a Django Project for a bit, until I took a break. One month later I dug back in to the project and went to run the server. I received an error:
django.core.exceptions.ImproperlyConfigured: Requested setting DEBUG, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.
I figured I must have tweaked something by accident. So I created a brand new Django Project (using a virtual environment), and just went to test the server. I received the same error. I tried the python manage.py shell solution listed in another answers but to no avail.
If it helps I'm on Linux with Django version 2.1.5 and Python 3.6.
Edit:
If anyone encounters something similar I found using python3 manage.py runserver works in place of using django-admin. Per Greg's answer below, I did begin to receive a new error ModuleNotFoundError: No Module named "mysite" exists. I will continue to search for an answer on that front.
Going off of the comments here.
If "env | grep DJANGO_SETTINGS_MODULE" returns empty, it means you have to set an environment variable stating where your settings.py file is located.
This can be done by doing the following:
export DJANGO_SETTINGS_MODULE=mysite.settings
Be sure to replace "mysite" with the name of your app!
I know this question has been asked before ,but not resolved .When ever i run django makemigrations and migrate, it does not create a my table in the data base .I have done research but yet, do not understand why this is happening and how i can resolve it .Any one has faced such a problem before and resolved it .Please share your solution thanks in davance
A couple of things are required to make a migration do something.
python manage.py makemigrations (builds instructions), python manage.py migrate actually alters the db specified in your settings.py
You must have a db specified in settings.py
This looks at the apps added in settings.py, if you modify a models.py for an app not added in the settings then it won't show up.
Lets assume you have a django website svn directory which is not under site-packages.
Whenever i run:
mysyper_dir/whatever_module/manage.py runserver 0.0.0.0:8888
and then connect, I realize that my request are still handled by the python files in:
....../site-packages/whatever_module/
while I can see the prints of
mysyper_dir/whatever_module/setting.py
from my server console.
is there a way to tell django that, every "non-framework" files it will ever need are in the "mysyper_dir/whatever_module" directory ?
Neither of these are Django specific (Python actually already handles this) but there's a couple of things you could do. You could set the environment variable PYTHONPATH, or you could add directories to sys.path. You can find more about where modules are located here.
If you are looking to have things just apply to Django, then adding to sys.path might be your best bet. You could try something weird like modifying manage.py and adding command line arguments after the #!/usr/bin/env python but that's uncharted territory for me.
I am getting the following error
After python manage.py syncdb
It says everything is synced, but then I see this
Not synced (use migrations):
- tastypie
How do I sync tastypie?
I also have South synced. As apparently that makes a difference.
The following SO question referred to this problem but did not solve it or at least I did not understand the solution: South manages a new app instead of syncdb
Can you please help me with this, thanks.
Keep in mind that this is my first time using Django
I saw another solution online but it required the app name and I put the app name down but it did not work (or maybe i don't know my app name). How do you find out the app name?
django-admin.py migrate tastypie