Django Populating New Project With Directories From Old - python

New to Django and I created a project with Django 3.0 based on a tutorial, then created Project 2 based on a second tutorial, following the steps.
But when I use the command django-admin startproject project2_project it populates project2's folder with all of the directories/files from project 1, and everything else on my Desktop.
When I run the server, I get Project 1's website. Have looked in the Django docs and on here but can't find any answers to this. Also, when I enter the virtual environment pipenv shell it says I am on my desktop: (Desktop) bash-3.2$ This might have something to do with it?

Related

Python doesn't recognise Django app folder

I am new to Django and was following the tutorial here (https://simpleisbetterthancomplex.com/series/2017/09/04/a-complete-beginners-guide-to-django-part-1.html#hello-world) to get my first application running. I could not reference my application so I decided to name everything exactly as is in the tutorial in another Python project. I am unable to import view from boards no matter what I do (change it to projectname.appname and a number of different variations that I found on here). I have tried this tutorial on another computer I do not have access to at the moment and can confirm that it works usually. Is this an issue with PyCharm/my Python environment?
Project Structure
Error I am receiving
Fixed
To resolve this I marked my Django Project Folder (not Python Project Folder) as root.

Django-admin module name not found?

I am using Django version 1.6.11 and when I want to create the project by using the command Django-admin start project my site it throws the error:
\Python27\python.exe: No module named Django-admin
and when I use Django-admin.py start project my site it opens a new file named Django-admin.py.
I don't know what the issue is as when I open an already created Django project I am able to run the project using python manage.py run server but then also I am not able to create new app inside the project as it requires Django-admin startapp.
Are you sure you are using the right command to start a project?
According to official documentation, it should be:
django-admin startproject mysite
not
Django-admin start project my site
Which means: no uppercase and less spaces.
New apps should be created using:
python manage.py startapp app_name_here
not through django-admin.
https://docs.djangoproject.com/en/2.0/intro/tutorial01/

Duplicate -tpl.c~ files when created a new project in Django (Atom Text Editor)

I created a new project with
django-admin startproject basicform
And then created a new application
django-admin startapp basicapp
But, when i started my server,
python manage.py runserver
It made duplicated files, like this
https://drive.google.com/open?id=1MTvpHf7pACsp9o_b129g5wPsKqwbbZDp
Is this an ERROR?
Should i delete the files?
I am working on django-1.11 and Python 3.6.4 :: Anaconda, Inc.
Also, when i tried running the server, it worked fine.
python manage.py runserver
https://drive.google.com/open?id=1arjf3U8Mm8ggwLTbSk5Gc9bd_FDl5lJj
EDIT:
I have deleted the duplicate -tpl.c~ files and the project is working fine.
"~" is a common suffix for backup files created by an editor. It is safe to remove them if you don't need them, and you should be using a VCS to handle old revisions regardless.

Why i am not seeing a .py file but something else (trying to create Django project)

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.

Import Existing Django Application into Pycharm

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.

Categories