Python doesn't recognise Django app folder - python

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.

Related

Run Django Project on other system

I have developed a student website using django which includes a database(MySQL), so now I want to run this django project in another system, so how can I run this django project in another system including the database(that is MySQL)
You can make a backup of the database and copy it to the other system. Then you can create a requirements.txt file to get the dependencies, or you just try to run the project and look which packages are missing. The last thing you have to do is that you may change some paths to different files, you added in your Project. This might also help you.
Hope I could help you!

Host Django application in the Lightsail's built in Apache server

I want to have a production ready Django app with Lighsail and for that I'm following two tutorials to achieve this
Deploy Django-based application onto Amazon Lightsail
Deploy A Django Project
From the Bitnami article can see that the AWS documentation follows its Approach B: Self-Contained Bitnami Installations.
According to:
AWS's documentation, my blocker appears in 5. Host the application using Apache, step g.
Bitnami's documentation, where it says
On Linux, you can run the application with mod_wsgi in daemon mode.
Add the following code in
/opt/bitnami/apps/django/django_projects/PROJECT/conf/httpd-app.conf:
The blocker relates to the code I'm being asked to add, in particular the final part that has
Alias /tutorial/static "/opt/bitnami/apps/django/lib/python3.7/site-packages/Django-2.2.9-py3.7.egg/django/contrib/admin/static"
WSGIScriptAlias /tutorial '/opt/bitnami/apps/django/django_projects/tutorial/tutorial/wsgi.py'
More specifically, /home/bitnami/apps/django/. In /home/bitnami/ can only see the following folders
. bitnami_application_password
. bitnami_credentials
. htdocs
. stack
and from them the one that most likely resembles /opt/bitnami/apps/ is /home/bitnami/stack/. Thing is, inside of that particular folder, there's no django folder - at least as far as I can tell (already checked inside some of its folders, like the python one).
The workaround for me at this particular stage is to move to a different approach, Approach A: Bitnami Installations Using System Packages (which I've done and managed to make it work as wrote in this blog post), but I'd like to get it to work using Approach B and hence this question.
The problem here is in the mentioning of the paths for both the project and Django.
In my case, projects are under /home/bitnami/projects/ where I created a Django project named tutorial.
Also, if I run the command
python -c "
import sys
sys.path = sys.path[1:]
import django
print(django.__path__)"
it'll print me the location where Django is installed
['/opt/bitnami/python/lib/python3.8/site-packages/django']
So, the httpd-app.conf should have instead at the end
Alias /tutorial/static "/opt/bitnami/python/lib/python3.8/site-packages/django/contrib/admin/static"
WSGIScriptAlias /tutorial '/home/bitnami/projects/tutorial/tutorial/wsgi.py'

Issue in running django server while pulling code from GIT

I am working on a project which also contains a got repo initialized in it, we are multiple people working on same project but on different branches,my scenario is one of my friends pushes code to his branch then i pull that code from his branch so now i am having merged code(his and mine) now i push the code to my branch that contains final code.
Now the problem is when i pulled code from his branch then my django server isn't starting, i think there is a directory issue, one more problem is when is witch to project view in pycharm it shows limited files with yellowish background and when i switch to project files it shows all files i am attaching both pictures
My project directory
project View
Project_files_vies

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.

Configuring Azure for Django/Python 3

I had a Django project that uses python 3.2+. Having been through a couple Azure classes I wanted to deploy my Django application through Windows Azure. I got the web site synced through my Git Repository, and following the advice of the MSDN forums, added the python 33 runtime in a folder called /PythonCore/ and added WSCGI.py to the scripts folder within there.
My website can''t find the CGI interface and likewise is failing to process HTTP requests. I know something must be wrong in my configuration, but I havn't a clue as to what. I was wondering if anyone might know what my error is.
WEBSITE_NODE_DEFAULT_VERSION 0.10.5
DJANGO_SETTINGS_MODULE DjangoApplication.settings
PYTHONPATH D:\home\site\wwwroot\DjangoApplication;
WSGI_HANDLER django.core.handlers.wsgi.WSGIHandler
Handler Mappings
* D:\home\site\wwwroot\PythonCore\python.exe D:\home\site\wwwroot\PythonCore\scripts\wfastcgi.py
Please let me know if any additional information is needed or you have an idea what I can try.
Azure Web Sites w Django currently requires Python version 2.7. Please see this:
http://www.windowsazure.com/en-us/develop/python/tutorials/web-app-with-django-and-mysql/
and
http://pytools.codeplex.com/wikipage?title=Django%20Web%20Site/Cloud%20Service%20Tutorial
Corresponding video walk thru:
http://www.youtube.com/watch?v=S7A7VNnsA_8
Python 3.x will be supported soon (hopefully fall 2013).

Categories