Komodo Code Completion for Django - django

Sorry to repeat old questions, but I didn't quite understand the answer.
The question was: How to enable auto-complete in Komodo Edit 5.2 for Django
Komodo Edit - code-completion for Django?
"It was already on my python path (could import django stuff via plain old python shell), however,komodo didn't know about it. Manually adding the dist-packages folder fixes it though"
In particular I don't understand the part in bold.
Can you give me a simple step by step recipe for that, please?
Using OSX Snow Leopard.
Thanks,
Greg

Go to File -> Preferences -> Languages -> Python. There you have the field Additional Python Import Directories where you can add the Django folder (actually the folder that contains the Django folder).

Related

why im not able to import pygame? [duplicate]

I've downloaded pygame-1.9.1release.tar.gz from the Pygame website. I extracted and installed it and it's working fine in the command line Python interpreter in Terminal (Ubuntu). But I want to install it for some IDE, like PyCharm. How can I do it?
Well, you don't have to download it for PyCharm here. You probably know how it checks your code. Through the interpreter! You don't need to use complex command lines or anything like that. You need to is:
Download the appropriate interpreter with PyGame included
Open your PyCharm IDE (Make sure it is up to date)
Go to File
Press Settings (Or Ctrl + Alt + S)
Double click on the option that looks like Project: Name_of_Project
Click on Project Interpreter
Choose the interpreter you want to use that includes PyGame as a module
Save your options
And you are ready to go! Here is an alternate (I have never done this, please try to test it)
Add PyGame in the same folder as your PyCharm file (Your PyCharm stuff is always in
a specific file placed by you during installation/upgrade)
Please consider putting your PyCharm stuff inside a folder for easy access.
I hope this helps you!
For PyCharm 2017 do the following:
File - Settings
Double click on your project name
Select Project Interpreter
Click on green + button on the right side of the window
Type Pygame in search window
Click Install package.
Not I'm saying that the answers above won't work, but it might be frustrating to a newbie to do command line magic.
If you are using PyCharm and you are on a Windows 10 machine use the following instructions:
Click on the Windows start menu and type cmd and click on the Command Prompt icon.
Use the command pushd to navigate to your PyCharm project which should be located in your user folder on the C:\ drive. Example: C:\Users\username\PycharmProjects\project name\venv\Scripts.
(If you are unsure go to the settings within PyCharm and navigate to the Python Interpreter settings. This should show you the file path for the interpreter that your project is using. Credit to Anthony Pham for instructions to navigate to interpreter settings.)
HINT: Use copy and paste in the command prompt to paste in the file path.
Use the command pip install pygame and the pip program will handle the rest for you.
Restart you Pycharm and you should now be able to import pygame
Hope this helps. I had a fun time trying to find out the correct way to get it installed, so hopefully this helps someone out in the future.
I just figured it out!
Put the .whl file in C:\Program Files\Anaconda3
While in the folder, click on the blue File tab in the upper left corner of the Window Explorer (assuming you're using Windows)
Click on Open Windows PowerShell as administrator
Write or just copy and paste: py -m pip install pygame
It should start installing
Done!
I hope it works for you. I know it did for me.
I already had pygame installed with python38-32
since its working just fine with it. I used this version of python us my project interpreter.
1.File -settings
2.according to your settings look for project interpreter
3.click on your current project interpreter and click on the add symbol
4.choose system interpreter
5.select the python version thats works with pygame for you
6.Note: some versions of pygame don't work with some versions of python be sure
of what are you doing.
7.hope it works.

Can't find "Set as Django Project" or Django actions in Eclipse with Pydev

MacOSX10.9.5, EclipseMars.1(4.5.1), Pydev3.0.0, Python3.4.3, Django1.9
I can't find "Set as Django Project" or Django actions in Eclipse though I could use it until yesterday.
I reinstalled the same versions of Python, Django, Eclipse and AptanaStudio3, and added Python and Django PATH to PYTHONPATH of Pydev Python Interpreter in Preferences again but the problem is not solved. I can't also create a new Pydev project. Maybe I deleted some important dotfile by mistake when I emptied the trash but I'm not sure if I did or if it's the cause or not. How can I fix the problem or what should I check to figure out what is the cause? Thank you in advance.
I solved the problem by myself. I just didn't notice the Pydev perspective was closed.
Window --> Perspective --> Open Perspective --> Other... and choose Pydev.
That's all. Now I can see Set as Django and Django actions with the Django logo. I had overlooked such a basic. Thank you!

Django autocomplete in Eclipse

I want to use the autocomplete of PyDev with Django in Eclipse. I've followed these two threads
Autocompletion in Django + pydev
PyDev and Django: Autocomplete not detecting Django?
so I went to
Windows -> Preferences -> PyDev -> Interpreters -> Python Interpreter
selected the libraries tab and added path\to\Django\Django-1.6.1\django
and then right-clicked on Project's name then Preferences -> PyDev - PYTHONPATH
clicked on the external libraries and added the project folder and
C:\Python27\Lib\site-packages
finally I went to
Window->Preferences->PyDev->Editor->Code Completion
and checked that the autocomplete was on and it was so. But still don't have the auto-complete on. But it doesn't even autocomplete the variables that I have defined in the same class. Could anyone help me on this?
I fixed this myself. The problem wasn't related to PYTHONPATH or anything like that I had said above. The problem was with Aptana! I also noticed that Aptana that is now available for Windows x86 was 3.4.2 rather than 3.5 that was installed before. I think they had noticed that there are bugs in 3.5 and are now providing the 3.4.2 version.
To fix this simply reinstall Aptana.
Note: if you are getting "Port not bound (found port -1). Is there an enabled firewall?" after you enter some text and try [Ctrl + Space] you likely have the same problem.
Hope that helps for you.

Sublime Text - Set project type as Django

A little confused. Trying to create a Django project in Sublime Text.
I have followed this netuts guide
So I have added a folder and set a project as django.sublime-project
I installed Djaniero plugin. So my question is how do I now turn this into a django project?
Djaniero is just a collection of snippets for Django.
If you're looking for a plugin that will give you autocompletion for Python, etc, take a look at SublimeCodeIntel or SublimeRope.

Newly created Pydev Django Project does not include initial package with Settings.py etc

When creating Django Pydev projects in Eclipse the default config package is created automatically with the following structure:
MyApp
__init__.py
settings.py
urls.py
wsgi.py
manage.py
Today I created a Django Pydev project and those files and initial package were not created.
I have tried several times to create new Django Pydev projects but the the initial structure is not being created.
This problem only just started happening. I have not had the problem prior to today.
Running this on the command line does work:
django-admin.py startproject mysite
The files and project structure are created correctly. So it's just Eclipse and Pydev that fails.
I am using Django 1.4, Pydev 2.5 and Eclipse Indigo 3.7 on Ubuntu 11.1
I had the same issue today but it turned out that it was because my project name was not handled - eg "My Project". The space threw it. Calling the project "MyProject" worked a treat.
From the cmd line it gives the following error - which eclipse is not returning:
c:\django-admin.py startproject "My Project"
Error: "My Project" is not a valid project name. Please use only numbers, letters and underscores.
I ran into the same issue on win7.
I also tried to run django-admin.py manually from command line. Instead of generating a project, it opened up a default editor for .py file. Then this was clear to me that it was because I installed some program which registered itself as the default program to run .py file. In my case it was WebMatrix2 but even if you don't install anything, there is a good chance that it is set to notepad by default by win7.
I knew that PyDev will actually run django-admin.py to generate the project. So my guess was that PyDev tried to run the .py file. Then since the program to run it was not python.exe, nothing was generated. PyDev ignored this error so there was nothing in the project.
Then the fix is simple. Choose any .py file, right click to open the properties window and change the default program to python.exe.
Now go back to Eclipse and try to create a django project again. You should be able to see manage.py file and other files created.
Hope this helps.
I was having this problem - I tried to create a project called test-django, and it wouldn't add manage.py etc to the structure. So I tried doing the same thing with django-admin.py and it failed and said only numbers, letters and underscores!
So the problem is that eclipse/pydev fail to report this error and make the project anyway!
I had a similar issue today (Win7). I had been using eclipse, PyDev and Django for a while and had no problems. Tried to create a new project today, and it failed to populate the project folder with manage.py etc.
I happen to have both Python 32 and 64 bit installed, but Django 32 bit. I forgot to select the 32 bit interpreter when I created the project, and so it called the 64 bit interpreter to run django-admin.py and failed silently. Once I selected the 32 bit interpreter it created the project folders as expected.
Met the same issue when creating a PyDev Django project in the virtual environment.
Unable to find out any effective solution either in Chinese or English. After a few tries, I've managed to resolve it
When creating the PyDev Django Project, instead of putting your project folder in the virtual environment folder, you need to choose another directory outside.
Eclipse Pydev Screenshot
I tend to believe this is a PyDev bug, as I can put my django project folder anywhere using the command:
django-admin startproject PROJECT_NAME.
It works fine in the virtual environment folder. Refer to my setup environment below:
Eclipse Oxygen: 4.7.1a
PyDev : 6.1.0.201711051306
Django : 1.11.7
Just to note, provided you have the latest PyDev, this should work (previous versions had issues with Django 1.4) -- it's possible that it's just missing a refresh (i.e.: it's creating it but not showing in the PyDev package explorer).
Just refresh it and see if it works -- and make sure you have 'refresh using native hooks' and 'refresh on access' selected on window > preferences > workspace.
If you still have an issue, please check if they really weren't created in the filesystem and if they weren't check your error log for some error there and report back.
Had the same issue.
Fixed by doing Help -> Check for Updates.
Updated Eclipse and restarted.
i met this issue, too.
However, after devastatingly searching online. I'd decided to re-install the plugin with a brand new Eclipse for Java EE Developer, Version: Indigo (previous was Classical Eclipse, Indigo).
And it worked!
I know this question was asked long time ago, but I faced the same problem with Eclipse Neon and I figured out possibly there is a bug.
I guess you used File>New>PyDev Project to create a project. I used MyProject as the name of the project so I did not have any space in the name, and therefore project name could not be the issue. You should see 3 steps to configure your project, while the 3rd one is not shown. The 3rd step is Django Setting and if you cannot get to that step, your files will not be created.
Instead if you use CTRL+N, you will see a different wizard and this way it takes you to 3rd step and all the file will be generated.