I´m starting to use Django with Pycharm IDE and have succesfully configured my first project.
However, I tried to add a new existing project to Pycharm and when trying to change the Run Configuration to use the manage.py of my secondProject(GuatepediaLocal), I don´t get an option to select it on the dropdown menu. When I try to run the project, it keeps running the PollSite manage.py runserver and not GuatepediaLocal´s manage.py runserver
Can anyone help me to solve this issue and configure an already existing Django Project on pycharm?
After some research I found that on the settings window of Pycharm I must add Django support to my project
That enabled the project on the dropdown menu. After that, I just added on the enviroment variables the correct path to my project´s settings.py.
Hope this helps someone someday :)
Open edit configuration wizard.
Menu > Run > Edit Configuration
Add new configuration by selecting the Django server from the left top button (button look like + sign). Look like below. Plus sign top left.
If you don't configure the Django setting. It will show you the fix button to fix the Django Setting. Django Setting looks like this. You can manually set these setting by navigating like this.
File > Settings > Language and Framework > Django
Django Setting wizard looks like this.
set the project path, manage.py file and settings.py file.
Related
I am actually following a youtube tutorial for learning Django and admin site is not showing properly.
The admin tab in the video looks like this:
My admin tab however looks like this:
An answer in stack overflow suggested to put DEBUG = True in settings.py file. But it is already set to that in my case.
You've probably set static files' location the wrong way. Sending settings.py is needed for any further help.
You can check this document for default values.
It would be better to start a simple project using the instructions provided in this documentation Django - Introduction tutorial
Initially, you can also try the following instructions to check it.
At first, install django (latest version) using the following command
python -m pip install django
Then, open a folder in which you would like to create a django project, and open the terminal in that folder, then paste the following code
django-admin startproject MyProject
Copy and paste the following two commands one-by-one,
py manage.py makemigrations
py manage.py migrate
After that, create a admin user by providing the e-mail, username and password through the following command as follows,
py manage.py createsuperuser
Now, copy and paste the link you get in the browser along with 'admin/', which will direct you to the admin login page as specified in the documentation
I've set break points in the template and i run the server but pycharm doesn't seem to pick up the breakpoints for the template but only the python files. Does anyone know how to fix this?
From Pycharm 2017.1
Prerequisite
Django is specified as the project template language.
To do that, open the Project Settings dialog, under the Project Settings select page Python Template Languages, select project where the templates reside, and then choose Django from the Template Language drop-down list.
Debugging a Django template
To debug a Django template, follow these general steps
Place breakpoints in the desired lines of the Django templates:
Launch Django server in the Debug mode.
This is how it's done:
On the main menu, choose Run | Edit Configurations.
If the desired Django Server run/debug configuration exists, select it, otherwise create a new one, as described in the section Creating and Editing Run/Debug Configuration.
Then click the button on the main toolbar, or press ⌃D.
PyCharm will open the template in your browser, and suspend at the breakpoints you've set.
The Debugger session starts, and Debug tool window appears.
In the Debug tool window, you can:
Examine the rendering contexts in the Variables pane.
Step through the breakpoints defined within the Django template.
Use the debugging console.
If you want to trace back exceptions that are raised in course of template debugging, open Breakpoints dialog, and in the Django Exception Breakpoints tab, select the check box Suspend.
Debugging Jinja and Mako templates is not supported.
https://www.jetbrains.com/help/pycharm/2017.1/debugging-django-templates.html
So I got advice in another question and they started talking about paths and .exe and that I should not put my projects in the scripts. So I added
C:python27\scripts to my path and nothing seemed to change except when I created a new project, and went into the GUI to look for the folder and found it, it just says Manage instead of manage.py. It says its a python folder.
I then took ..\scripts out of the path and created the project again and still got the same thing.
Whenever I did it the first time without changing anything, I did see a manage.py file.
So the tutorial I am working that introduces me to Django asked me to open the manage.py file, and when I try to of course it tells me it can't open the file because it does exist. So what do I do?
If I'm understanding you correctly, you're simply trying to create a django project. Since you didn't mention which tutorial you're using, I'll link this resource and recommend following it page for page. It's a great walk-through for learning how to create apps and it's broken into sessions you can do over a period of time:
To answer your question: when you create a django project with django-admin startproject mysite it will install the manage.py into the mysite directory. If that doesn't answer your question, try describing the precise steps you're taking to create a Django project including all commands you're using (if any).
It's also helpful to know if you're using a virtual environment.
I have an existing Django application. I want to start developing it in Pycharm, instead of sublime text and command line. I have opened my existing directory (cloned from my git repo) into Pycharm but I can not for the life of me figure out how to set it as a django project. All the examples I see are new projects from scratch or existing pycharm projects, neither of which applies to me. I'm running on a brand new mac, if that helps (I'm coming from Ubuntu)
You need to enable Django Support in the project settings under Project Settings -> Django. You also would need to set up the project root, path to settings.py and manage.py.
I keep getting this error every time i create a new django project using titanium (eclipse) with pydev.
Actually, it did create the file settings.py
I wonder what make this error and how to fix it?
It's really a PyDev issue with Django 1.4. A new release (2.5.0) will be done later this week properly supporting the layout changes in Django 1.4.
You can still use the project created this way, but you have to do some manual things:
Move the contents inside of the folder that was created to your module (this was the structural change done in django 1.4)
The settings.py won't have the details you entered in the wizard (i.e.: manually edit the settings.py)
In the project django's properties (right click project > properties and check the django properties page), you have to put the proper settings to the settings module and manage.py.
I updated my pydev today to the last version and now it seems to be working beautifully...