Linking django object log to a project - python

I trying to add to my project django log object to my django project
I followed these steps
1)pip install django-object-log
2)copied the object_log folder into your Django project.
3)Add "object_log" to INSTALLED_APPS
4)Run ./manage.py syncdb
5)add this url to my project urls ....url(r'yasmina', include('object_log.urls')),
But i don't know what to do next so any help plz ??
and this is one of the urls in url.py of the django object log ...url(r'^user/(?P\d+)/actions/?$', 'list_user_actions', name="user-object_log-actions"),
when i runned the server and added this url to my browser http://localhost:8000/yasmina/user/2/actions/
I got error this url doesnt match

Looks like your Url pattern matches
http://localhost:8000/user/2/actions/.

Related

Django Server Unable to Open Admin Page

I am following an online course on Django, and my browser fails to load the admin page. I created a job, added it to INSTALLED_APPS in settings.py, and added it in admin.py as follows:
from .models import Job
# Register your models here.
admin.site.register(Job)
In urls.py I believe I have the standard admin url
urlpatterns = [
path('admin/', admin.site.urls),
path('home/', jobs.views.home, name='home'),
]
I'm not sure if any other any information is needed but please ask if there is anything else. I start the server using python manage.py runserver and it can access /home okay, but if I change the url to admin or admin/ it says 'Firefox can’t establish a connection to the server at 127.0.0.1:8000.'.I've tried it on different browsers and the same outcome is reached. My question is similar to the one here: Django error browser is unable to connect at 127.0.0.1:8000/products/ and I tried all of the solutions there but none worked. I followed the tutorial very specifically, so I have no idea what is causing this. I am using Atom on a Windows 10 machine, the project is connected to a postgresql database.
UPDATE/EDIT 08/23/20 10:31AM PST.
Here is a screenshot of INSTALLED_APPS:
There is no error in console when I try to open admin. If I run the server as shown below and open the link http://127.0.0.1:8000/admin, the server just stops working and my command line returns to just taking in commands. Details in screenshot below.
UPDATE/EDIT 08/23/20 12:07PM PST.

Django 404 page not found

I've been doing a lesson on udemy trying to make a clone site of producthunt using django. I've tried asking there, but I don't get an answer. For some reason when I run the exact same code as the instructor, I get an error when trying to load the page localhost:8000/signup or any other pages other than the home page.
I get this error:
error
Settings file:
settings
Main urls:
main urls
app urls (named accounts):
app urls
views:
app views
finally my file structure for reference:
directory
I've been trying to figure it out with no avail. Any help would be great thank you.
signup is a route in the accounts app. In your main urls.py you include your accounts.urls under accounts/. Putting that all together, with your current structure you should be hitting accounts/signup rather than just signup.
There's no url /signup in your web.
You're url is for accounts/signup/

How to prevent URLconf settings from being carried onto new project?

I recently worked on a project that had an app named 'catalog'. While I was working on it, I changed the URLconf so that the root URL could be redirected to the app.
I wrote the below code to do this:
# within the project's URLconf file
from django.views.generic import RedirectView
urlpatterns += [
url(r'^$', RedirectView.as_view(url='/catalog/', permanent=True)),
]
I was working on the local development server, and the root URL (127.0.0.1:8000) was successfully redirected to the 'catalog' app (127.0.0.1:8000/catalog/).
However, when I created a new project, the root URL of this NEW project ALSO tried to redirect to the 'catalog' app of the previous project.
So where as I should be seeing the "it worked!" page at the root URL for the new project, I am instead redirected to the 'catalog' app's URL of the previous project, where the 404 page is displayed (obviously, because the 'catalog' app is not part of the new project).
Instead of this:
It Worked Page
Seeing this:
404 Page
It seems to me that the settings from the previous project have somehow affected the local server permanently so that the modified URLconf setting is carried on to any subsequent projects.
I could not find exactly what was causing this issue so I just ran the new project on a different port (8001) using the
python manage.py runserver 8001
command, and this seemed to fix the issue. However, I regard this only as a temporary workaround and I want to find out the root cause of the issue.
If I can't fix it, I would like to "reset" the default port (8000) so everything goes back to default settings.
Is there a way to completely "reset" either the local server or django itself so that all the settings go back to how they were released?

Extending Customer's view from Django-Oscar

I am trying to override customer app in django-oscar. For that I have created customer app in my apps folder in project. While I run that project I encountered an error in django 1.7.4 as below:
django.core.exceptions.ImproperlyConfigured: Application labels aren't unique, duplicates: customer
I went through the doc in django https://docs.djangoproject.com/en/1.7/ref/applications/#django.apps.AppConfig, But its not working out. So Is there any other way to extend any django-oscar's app and modify the code as per requirements.
This is my customer app's views.py:
from oscar.apps.customer.views import ProfileView as CoreProfileView
class ProfileView(CoreProfileView):
template_name = 'new_account.html'
and below is project's settings.py code snippet:
INSTALLED_APPS = [
'apps.customer',
]
Thanks in advance.
Run this command to overide apps from django oscar
./manage.py oscar_fork_app appname yourprojectname
yourprojectname-Your folder path to where the app should be created
Once you run this command a new app will be created with overided models,admin files.now add the app path inside
get_core_apps(['yourproject.order']) in settings.py file.
For more information please refer
http://django-oscar.readthedocs.org/en/latest/topics/customisation.html

How to modify django cms multilingual middleware

hey guys, im trying to internationalize my site, so i have the django cms multilingual middleware class in my settings.py , when viewed from brasil, the url changes to
www.ashtangayogavideo.com/pt/ash/homepage/ resulting in a 404, because my site is in www.ashtangayogavideo.com/ash/en/homepage, how can i configure the middleware, or settings.py, so that the language code is added after the /ash/ ? .
Sounds like you need to modify your urls.py, not your settings or middleware.

Categories