django deprecation warning location - python

I am getting a deprecation warning while running tests for an app that I have installed/used in a django site. The deprecated feature is django/utils but the actual file that was using the deprecated feature is not given. Is there a way to get django to tell me which file is giving the deprecation warning or do I have to manually go through every single file in the app to find the reference? I am still new to testing in Django so I appreciate the help very much.

Run python using error warnings to give you full traceback:
python -Werror ./manage.py runserver # or whatever command gave the error
and you should be able to track down where it's coming from.
The dupe you mentioned will also work.

Related

Briefcase build - Unable to load file

I am trying to create my first app using briefcase and python through Beeware. I am following the tutorial as listed on the website, however upon running briefcase build i recieve the following messages in the console:
briefcase build
[helloworld] Building App...
Unable to load file: "src\Hello World.exe"
Setting stub app details...
Unable to update details on stub app for helloworld.
the only thing I have noticed that is different from the tutorial is that upon running briefcase create I receive this message :
[helloworld] Created windows\app\Hello World
Instead of this one as shown in the tutorial
[helloworld] Created windows\msi\Hello World
Any help would be greatly appreciated thank you :)
It's difficult to say from the details you're provided. The error would be consistent with using the wrong Windows template for the app - but if you're doing the tutorial, you shouldn't be modifying anything that would cause this to be a problem.
The app vs msi reference isn't anything to be concerned about; that was a change in the most recent version of Briefcase, and we've neglected to update the tutorial to reflect the change.
My initial guess would be that a network error has occurred when Briefcase downloaded the Windows app template. Your Briefcase project should contain a file named windows\app\Hello World\src\Hello World.exe. The error you're reporting indicates that file doesn't exist.
My best suggestion for a fix would be to clear out your cookiecutter cache. Look in your home directory (C:\Users\<your username>) for a .cookiecutters folder; in that folder, there should be a briefcase-windows-app-template subfolder. Delete that subfolder; then delete the windows folder in your Briefcase project, then re-run briefcase create.

cannot import name 'url' from 'django.conf.urls'

I have been trying to makemigrations in my django project but I keep getting this error constanly even though I'm using path instead of url can someone please help me? The error is being caused by the froala_editor path but I don't understand why.
as per django docs here:
django.conf.urls.url() was deprecated since Django 3.1, and as per the release notes here, is removed in Django 4.0+.
so you cannot use fedora_editor with django 4

How to disable errorr message 'print keyword can't be used as identifier in python 2' in pycharm?

I am using PyCharm 2018.3.4 (Professional Edition) and I keep getting this error messsage even on simple statements such as
print(matching_bids)
or
print("packed",str(packed))
I know this is more of a suggestion, but the only 3 top results in Google talk about this problem, and there is an unanswered question about this in the jetbrains forum. Hence, I have no idea what to do about this error, because it cannot be a syntax error. I am not able to disable it from the inspections either, and cannot disable 'All Inspections' just for this and write more erroneous code without pertinent warnings.
Even if I create a new .py file and just enter
print("hi")
it still shows this error.
I am using 3.7 python with a django ver 2.0.1
Update:
This is my project interpreter:
As pointed out by #rdas in comments. Please make sure you have set Python 3 as your project interpreter.
Reference : https://www.jetbrains.com/help/pycharm/configuring-python-interpreter.html
Based on the update of your post, to just disable the error do this:
Go To File > Settings > Editor > Inspections
Search for "identifier"
Disable "Correctness of identifier reference"
I do not recommend this but if you see no other way to solve this issue this is a temporary fix.

Django lack detail of error

Django is not giving me detailed information about the error.
For example when I get ImportError, I can not see where the error is comming from. Which file which line. It only gives me ImportError: cannot import name ___. But it is not enough to find where the error is. It is not only about ImportError.Many error is given to me with lack of detail like that. I am really bored with searching where is the error and it takes my time.
Is there a way to make it to give me more information about error in DJango.
I am using python==2.7 and django==1.5.3.
Set DEBUG = True in your settings.py and start your server with python manage.py runserver --traceback

Getting weird python error when I run a simple django script in Eclipse, not happening in console

I am running a basic script that sets up the django environment by itself, to enable me to test the ORM features of django without having to implement web pages. The script then imports one of the types defined in my models. This error doesn't happen when I run this script from iPython, only from eclipse. Simply doing this import causes a weird exception like the following:
Exception AttributeError: "'NoneType' object has no attribute 'print_exc'" in <bound method Signal._remove_receiver of <django.dispatch.dispatcher.Signal object at 0x026802B0>> ignored
My script is as follows:
from django.core.management import setup_environ
import settings
setup_environ(settings)
from stats.models import Person
for p in Person.objects.all():
print p.Name
After importing an existing Django project in Eclipse I had the same AttributeError
I just removed the *.pyc files... and it works... !?
right click on project ->pyDev -> remove *.pyc, *.pyo, ...
After some judicious googling, I'd say that Eclipse is causing the problem and that it may be hard to trace. print_exc is a function in Python's traceback module. Eclipse may be trying to show you a traceback, failing, and eating the result in the process.
I think a reasonable workaround would be to continue work on this script in a tool that doesn't present you with inscrutable errors. You may find an actual (fixable) error in your code, or you may find that Eclipse was raising a false alarm due to a bug in its Python integration.
If at that point you're unsure whether there is a problem with your code, adding some tests might be helpful.
Its possible that eclipse is using a different version of the python interpreter?
Could you give more details, such as the Person model.
Without seeing that I would guess the model attribute is meant to be in lowercase (ie p.name)
As far as i see, you do not havbe any problem with importing your modules. Try this to check if everything you need is ready for you. Probably that would not be the reason of your problem but better you check it too
iPuthon imports django system path automatically, so what you need is alresdy ready under your hands.
import sys
sys.path
check this out to see if all you need is there when you run it from eclipse, fiff with ipython result...

Categories

Resources