Defining Models outside models.py

2019-07-25 Thread Sam Taiwo
Hi everyone,

I know there are currently 3 ways to define a model in Django
1) Define it directly in the models.py file
2) Define it directly in a models package in the same directory as your 
other app files
3) Define it somewhere completely different and just import the models into 
the models.py

My question is, is there a way to write a model in any arbitrary file in 
you directory and link it to your app without having to use models.py file 
or directory.
For example is there a way to write a model directly in the views file and 
then add some config to the settings or elsewhere to enable Django to know 
of it's existence and pick up any changes that happen to it.
I don't mind if it's a complete hack
Thanks

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/95f073eb-8309-4454-8cfd-b190dde90cef%40googlegroups.com.


Re: Minimum Hardware requirement - reg

2019-06-25 Thread Sam Taiwo
I think think the first advice is way off base in two ways.

1) It's not clumsy to have 8 apps if that is the the structure of the
project that makes each part encapsulated and reusable.

2) 30 concurrent users in one app can be more demanding than 1000 in
another. It really depends on what each user is doing. Though it if your
site is like 99% of others you shouldn't't need to worry about hardware.

On Wed, 26 Jun 2019, 00:47 Yoo,  wrote:

> 8 app modules? That's a little clumsy. Something that would require that
> many app modules would be like docs.google.com and drive.google.com.
> Google has a LOT of different platforms which, if programmed in Django,
> would need several app modules. I'm 90% sure you'll only need one app.
>
> Hardware requirement is not something you need to consider based off
> Django. It's more about the transaction costs (writes and reads and etc.).
> Since it's only 30 clients, I imagine self hosting wouldn't be a problem at
> all. You could probably buy a Raspberry Pi 4 and host on there without a
> problem for the next 5 years.
>
> For cron jobs, check out this:
> https://stackoverflow.com/questions/573618/django-set-up-a-scheduled-job .
> You can also use the Advanced Python Scheduler (APS) for scheduled tasks.
>
> Several users logging into the system isn't a problem. Django has session
> authentication, so users can do whatever they want, concurrently. If you're
> looking into setting up a Chatroom package, you can check out python's
> asyncio and django-channels package for asynchronous tasks.
>
> Again, hardware with the conditions you listed should be the least of your
> worries. Just make sure that everything works and is secure. You could
> utilize Django-registration and Django-pwned-passwords. Make sure your
> setting's important information, like the secret key and database
> passwords, are stored in environment variables.
>
> On Tuesday, June 25, 2019 at 2:19:18 PM UTC-4, Raja Sekar Sampath wrote:
>>
>> Hi,
>>
>> What are the facts to be considered while determine the server
>> configuration for a Django Application?
>>
>> My Client preferring self hosting, the project having 8 different (apps)
>> modules and we expect 20 to 30 users concurrently login into the system and
>> Its having automated cron jobs
>>
>> Thanks & Regards,
>> Raja Sekar Sampath
>>
>> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/a8e59b16-7a6e-43fc-8ffe-63d0e77ab19e%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHKA7fB3yRYozsyoyeS7V4-rM8wwnTrHGrJi_9CZh8zUL-xKgQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Any open source project for beginner to start with ?

2019-05-15 Thread Sam Taiwo
Hi,

If you believe you are ready for open-source contribution, a good start
would be just contributing back to Django.
https://code.djangoproject.com/query?status=!closed=1=Accepted=priority

Here you can find "easy" ways to contribute. If you don't feel like you are
still up to the task, then continue to stretch yourself by building bigger
applications till you feel comfortable to come back and contribute.
I feel like Django is the best place to start, considering it will be the
framework you will have the most experience with till date.

Kind Regards
Sam

On Wed, May 15, 2019 at 9:44 PM himanshu chouhan 
wrote:

> Hi All,
>
> I know this ppl discuss really important issue here, I'm trying my luck in
> django, if anyone could suggest me any open-source project to start with or
> else if anyone is open to collaboration with their project, please do tell
>
> I have built a fully functional django + bootstrap website and looking for
> opportunity to learn further more. Any help would be much appreciated.
>
> Regards
> himanshu
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/1d815960-e09d-4290-a44d-db4792d38e7a%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHKA7fC7PpobE4%3D4aNM1_AwJeMAL0o6sN85fEYwUi2DFFeCMcw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Channels & WebSocket - failed: Error during WebSocket handshake: Unexpected response code: 403

2019-03-11 Thread Sam Taiwo
I'm not sure, but it looks like you are trying to connect to a localhost
which is fine locally but not in production. You probably need to change
your frontend code to route properly. This is all speculation as you have
not shown your application code, I don't think you'll get many good
answers...

On Tue, Mar 12, 2019, 00:48 stunaz  wrote:

> Hi,
> my set works well in dev, but failed in production
>
> Here is my logs on my server, any advises?
>
>
> 2019-03-11 20:33:22,819 DEBUGParsing Redis URI
> 'redis://localhost:6379'
> 2019-03-11 20:33:22,819 DEBUGCreating tcp connection to ('localhost',
> 6379)
> 2019-03-11 20:33:22,829 DEBUGWebSocket closed for ['127.0.0.1', 49358]
> 2019-03-11 20:33:27,915 DEBUGUpgraded connection ['127.0.0.1', 49364]
> to WebSocket
> 2019-03-11 20:33:27,917 INFO failing WebSocket opening handshake ('Access
> denied')
> 2019-03-11 20:33:27,918 WARNING  dropping connection to peer tcp4:127.0.
> 0.1:49364 with abort=False: Access denied
> 2019-03-11 20:33:27,919 DEBUGWebSocket ['127.0.0.1', 49364] rejected
> by application
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/b8fb8b10-de4f-46b7-bf96-d4ce4ad86993%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHKA7fBOf_qqMn0%2BcWx%3D6SSyVFZtwi40gEmA2DrQK5Km31KkVQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: how to create a Django project without using an IDE, but using the django-admin startproject command

2019-03-10 Thread Sam Taiwo
Make sure your virtual environment is activated, you have to activate it
each time you create a new terminal.

Also contrary to what someone else said, you can use django-admin anywhere,
while you must be in the correct directory to run the manage.py file

On Sun, Mar 10, 2019, 07:38 abel otugeme  wrote:

> Make sure your virtual environments are set up well.  Also make sure your
> running that command from the folder where your manage.py file is...
> On Mar 9, 2019 7:12 PM, "Ando Rakotomanana" 
> wrote:
> >
> > Hello, I'm still starting with django. And I have a problem with the
> creation of the project, I write: "django-admin startproject DjangoTest" in
> the cmd of my windows and it tells me that django-admin is not an internal
> command. While I typed the same code this morning in the cmd and it worked.
> And I do not understand why?
> > I have python 2.7.0 and 3.7.2 and django 1.6.2 installed on my windows
> 8.1
> >
> > --
> > You received this message because you are subscribed to the Google
> Groups "Django users" group.
> > To unsubscribe from this group and stop receiving emails from it, send
> an email to django-users+unsubscr...@googlegroups.com.
> > To post to this group, send email to django-users@googlegroups.com.
> > Visit this group at https://groups.google.com/group/django-users.
> > To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/8bc18725-3935-4740-9b08-4964b686ddf1%40googlegroups.com
> .
> > For more options, visit https://groups.google.com/d/optout.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAMrS0S8j4kMGc3sNYKX2G7E6tuzB%3DVS5dPWYTzJR__ZxZnMx2A%40mail.gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHKA7fBhZycKc9BCgyRqU8pqpHWHuZ5RWXt2exv%2Bitcg3u6Q7Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django credit card redaction app - - MultiValueDictKeyError

2019-03-07 Thread Sam Taiwo
I would be careful how you pass the data on get, somewhere in your front
end code you are probably not passing the data through as you expected.
Instead of using .GET, use .GET.get to get your data. This will either
return the value you want, or none. I think you have made the error of not
passing your data to the get header as you didn't explicitly write this on
the form element. Check the URL and log the get object in Django to make
sure the data is actually appearing in both.

On Thu, Mar 7, 2019, 13:52 drone4four  wrote:

> Hello!
>
> I’m trying to run a basic Django app which redacts a 16 digit number
> entered by the user. I had a it running a few minutes ago. I’m not sure
> what I changed, but now I am getting a MultiValueDictKeyError. I’ve triple
> checked every variable. The only dictionary in my project is in views.py at
> line 7. As far as I can tell, it’s all accurate and positioned correctly. I
> don’t recall changing this dictionary or any other operator around this
> line. I’m stumped. What would you people suggest? Have a look at my setup.
>
>
> *Here is the error and traceback in full:* https://pastebin.com/QwSrmAJx
>
> Here is my urls.py:
> from django.conf.urls import  include, url
>
>
>
> from django.contrib import admin
>
> from django.urls import path
>
> from . import views
>
>
> urlpatterns = [
>
>url(r'^admin/', admin.site.urls),
>
>url(r'^$', views.home, name='home'),
>
>
>
> views.py:
> from django.http import HttpResponse
>
>
>
> from django.shortcuts import render
>
>
> def home(request):
>
>number = request.GET['ccEntry']
>
>redacted_num = '   {}'.format(number[-4:])
>
>return render(request, 'home.html', {'number':number, 'redacted_num':
> redacted_num})
>
>
>
> home.html template:
> 
>
>
>
>
> 
>
> 
>
>  
>
>Enter your fake Chuckee Cheese Neptune credit card number!
>
>
>
>  
>
>  
>
>  
>
>Must be a 16 digit number.
>
>  
>
>  
>
>
>
>
>
>
>
>
>
>Original Card Number:
>
>
>
>{{ number }}
>
>
>
>Redacted Card Number:
>
>
>
>{{ redacted_num }}
>
>
>
> Did this work?
>
>
>
> 
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/49da3086-6f3d-415b-b451-7e4c6a6e542c%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHKA7fAzRPxGX29n374c7X9c-tqCL3MLAdq8F_bD_5_bdgZGhg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: REST Framework alternatives

2019-02-05 Thread Sam Taiwo
What validation does he specifically need? He could probably get away with
writing a few helper functions himself!

On Tue, Feb 5, 2019, 17:50 Miguel Ángel Cumpa Ascuña <
miguel.cumpa.asc...@gmail.com wrote:

> Django tastypie
> good luck!
> https://django-tastypie.readthedocs.io/en/latest/toc.html
>
> El mar., 5 feb. 2019 a las 11:52, Victor Porton ()
> escribió:
>
>> My buddy says that REST Framework is complex and inflexible.
>>
>> So the question: Any other framework which supports validating JSON data?
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To post to this group, send email to django-users@googlegroups.com.
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/1880c6a4-56aa-4073-bbe0-0dbf042587a8%40googlegroups.com
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAOZHYKP9xCYhLqZneVN7A7qiS9tGF40WLyz8aPor5pfMQZ0JJg%40mail.gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHKA7fC%3D%2BPMR8Teyrne%2B%3Dr0hCxoAf031p6xFNeaSN2BQAPwVYg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


ChannelsLiveServerTestCase Apps are not loaded error

2018-12-31 Thread Sam Taiwo
I am trying to follow the 4 part channels tutorial, however I am getting an 
error on the last part where we run selenium to test against a live server. 
It's not the end of the world as I can still run the server with no 
problems, however it limits my ability to test which is a shame.
I have the full details in the closed issue below (to avoid repetition)
https://github.com/django/channels/issues/1207

I have somehow also managed to get these tests to run and pass with 
channels version 2.0.2 since opening the issue, however versions 2.1.6 
still fails.
I'm unfortunately not experienced enough with the packages in the error 
trace to diagnose the problem myself.
Thanks in advance, hopefully this is enough information.
I can provide more on request.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/f826639c-b1f7-4af8-9559-1d2a7dd99e32%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.